config

package
v0.0.0-...-b1b3a06 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 24, 2024 License: MIT Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvironmentVar      = "BCD_ENV"
	EnvironmentDev      = "development"
	EnvironmentProd     = "production"
	EnvironmentBox      = "sandbox"
	EnvironmentTestnets = "testnets"
)

Environments

Variables

This section is empty.

Functions

This section is empty.

Types

type APIConfig

type APIConfig struct {
	ProjectName   string           `yaml:"project_name"`
	Bind          string           `yaml:"bind"`
	CorsEnabled   bool             `yaml:"cors_enabled"`
	SentryEnabled bool             `yaml:"sentry_enabled"`
	SeedEnabled   bool             `yaml:"seed_enabled"`
	Frontend      FrontendConfig   `yaml:"frontend"`
	Seed          SeedConfig       `yaml:"seed"`
	Networks      []string         `yaml:"networks"`
	PageSize      uint64           `yaml:"page_size"`
	Periodic      *periodic.Config `yaml:"periodic"`
}

APIConfig -

type Config

type Config struct {
	RPC       map[string]RPCConfig     `yaml:"rpc"`
	Services  map[string]ServiceConfig `yaml:"services"`
	Storage   StorageConfig            `yaml:"storage"`
	Sentry    SentryConfig             `yaml:"sentry"`
	SharePath string                   `yaml:"share_path"`
	BaseURL   string                   `yaml:"base_url"`
	Profiler  *Profiler                `yaml:"profiler"`
	LogLevel  string                   `yaml:"log_level"`

	API APIConfig `yaml:"api"`

	Indexer struct {
		Networks      map[string]IndexerConfig `yaml:"networks"`
		ProjectName   string                   `yaml:"project_name"`
		SentryEnabled bool                     `yaml:"sentry_enabled"`
	} `yaml:"indexer"`

	Scripts struct {
		Networks []string `yaml:"networks"`
	} `yaml:"scripts"`
}

Config -

func LoadConfig

func LoadConfig(filename string) (Config, error)

LoadConfig -

func LoadDefaultConfig

func LoadDefaultConfig() (Config, error)

LoadDefaultConfig -

type Context

type Context struct {
	Network types.Network
	RPC     noderpc.INode
	Mempool *mempool.Mempool

	StorageDB *core.Postgres

	Config     Config
	TzipSchema string

	Storage         models.GeneralRepository
	Accounts        account.Repository
	BigMapActions   bigmapaction.Repository
	BigMapDiffs     bigmapdiff.Repository
	Blocks          block.Repository
	Contracts       contract.Repository
	GlobalConstants contract.ConstantRepository
	Migrations      migration.Repository
	Operations      operation.Repository
	Protocols       protocol.Repository
	Tickets         ticket.Repository
	Domains         domains.Repository
	Scripts         contract.ScriptRepository
	SmartRollups    smartrollup.Repository
	Stats           stats.Repository

	Cache *cache.Cache
}

Context -

func NewContext

func NewContext(network types.Network, opts ...ContextOption) *Context

NewContext -

func (*Context) Close

func (ctx *Context) Close() error

Close -

type ContextOption

type ContextOption func(ctx *Context)

ContextOption -

func WithConfigCopy

func WithConfigCopy(cfg Config) ContextOption

WithConfigCopy -

func WithLoadErrorDescriptions

func WithLoadErrorDescriptions() ContextOption

WithLoadErrorDescriptions -

func WithMempool

func WithMempool(cfg map[string]ServiceConfig) ContextOption

WithMempool -

func WithRPC

func WithRPC(rpcConfig map[string]RPCConfig) ContextOption

WithRPC -

func WithStorage

func WithStorage(cfg StorageConfig, appName string, maxPageSize int64) ContextOption

WithStorage -

func WithWaitRPC

func WithWaitRPC(rpcConfig map[string]RPCConfig) ContextOption

WithWaitRPC -

type Contexts

type Contexts map[types.Network]*Context

Contexts -

func NewContexts

func NewContexts(cfg Config, networks []string, opts ...ContextOption) Contexts

NewContext -

func (Contexts) Any

func (ctxs Contexts) Any() *Context

Any -

func (Contexts) Close

func (ctxs Contexts) Close() error

Close -

func (Contexts) Get

func (ctxs Contexts) Get(network types.Network) (*Context, error)

Get -

type DatabaseConfig

type DatabaseConfig struct {
	ConnString string `yaml:"conn_string"`
	Timeout    int    `yaml:"timeout"`
}

DatabaseConfig -

type FrontendConfig

type FrontendConfig struct {
	GaEnabled      bool              `yaml:"ga_enabled"`
	MempoolEnabled bool              `yaml:"mempool_enabled"`
	SandboxMode    bool              `yaml:"sandbox_mode"`
	RPC            map[string]string `yaml:"rpc"`
}

FrontendConfig -

type IndexerConfig

type IndexerConfig struct {
	ReceiverThreads int64            `yaml:"receiver_threads"`
	Periodic        *periodic.Config `yaml:"periodic"`
}

IndexerConfig -

type OAuthConfig

type OAuthConfig struct {
	State string `yaml:"state"`
	JWT   struct {
		Secret      string `yaml:"secret"`
		RedirectURL string `yaml:"redirect_url"`
	} `yaml:"jwt"`
	Github struct {
		ClientID    string `yaml:"client_id"`
		Secret      string `yaml:"secret"`
		CallbackURL string `yaml:"callback_url"`
	} `yaml:"github"`
	Gitlab struct {
		ClientID    string `yaml:"client_id"`
		Secret      string `yaml:"secret"`
		CallbackURL string `yaml:"callback_url"`
	} `yaml:"gitlab"`
}

OAuthConfig -

type PostgresConfig

type PostgresConfig struct {
	Host     string `yaml:"host"`
	Port     int    `yaml:"port"`
	User     string `yaml:"user"`
	DBName   string `yaml:"dbname"`
	Password string `yaml:"password"`
	SslMode  string `yaml:"sslmode"`
}

PostgresConfig -

func (PostgresConfig) ConnectionString

func (p PostgresConfig) ConnectionString() string

ConnectionString -

type Profiler

type Profiler struct {
	Server string `yaml:"server"`
}

Profiler -

type RPCConfig

type RPCConfig struct {
	URI               string `yaml:"uri"`
	Timeout           int    `yaml:"timeout"`
	Cache             string `yaml:"cache"`
	RequestsPerSecond int    `yaml:"requests_per_second"`
	Log               bool   `yaml:"log"`
}

RPCConfig -

type SeedConfig

type SeedConfig struct {
	User struct {
		Login     string `yaml:"login"`
		Name      string `yaml:"name"`
		AvatarURL string `yaml:"avatar_url"`
		Token     string `yaml:"token"`
	} `yaml:"user"`
	Accounts []struct {
		PrivateKey    string `yaml:"private_key"`
		PublicKeyHash string `yaml:"public_key_hash"`
		Network       string `yaml:"network"`
	} `yaml:"accounts"`
}

SeedConfig -

type SentryConfig

type SentryConfig struct {
	Environment string `yaml:"environment"`
	URI         string `yaml:"uri"`
	FrontURI    string `yaml:"front_uri"`
	Debug       bool   `yaml:"debug"`
}

SentryConfig -

type ServiceConfig

type ServiceConfig struct {
	MempoolURI string `yaml:"mempool"`
}

ServiceConfig -

type StorageConfig

type StorageConfig struct {
	Postgres   core.Config `yaml:"pg"`
	Timeout    int         `yaml:"timeout"`
	LogQueries bool        `yaml:"log_queries,omitempty"`
}

StorageConfig -

type TezosDomainsConfig

type TezosDomainsConfig map[string]string

TezosDomainsConfig -

type TzKTConfig

type TzKTConfig struct {
	URI     string `yaml:"uri"`
	BaseURI string `yaml:"base_uri"`
	Timeout int    `yaml:"timeout"`
}

TzKTConfig -

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL