config

package
v0.0.0-...-aca7f8d Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2021 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCLINoColorToggle = false
	DefaultCLIDebugToggle   = false
)

Default CLI configuration

View Source
const (
	DefaultBubblyDir      = ".bubbly"
	DefaultReleaseSpec    = "" // default spec is under bubbly dir
	DefaultReleaseProject = "default"
	DefaultOrganization   = "bubbly"
)

Default Bubbly Release configuration

View Source
const (
	DefaultServerHost = ""
	DefaultServerPort = "8111"
)

Default Bubbly Server configuration

View Source
const (
	DefaultStoreProvider = "sqlite"
	DefaultRetryAttempts = 5
	DefaultRetrySleep    = 1
)

Default store configuration

View Source
const (
	DefaultPostgresAddr     = "postgres:5432"
	DefaultPostgresUser     = "postgres"
	DefaultPostgresPassword = "postgres"
	DefaultPostgresDatabase = "bubbly"
)

Default store configuration for Postgres

View Source
const (
	DefaultNATSServerHTTPPort = "8222"
	DefaultNATSServerPort     = "4223"
)

Default configuration for NATS Server

View Source
const (
	DefaultClientAuthToken = ""
	DefaultBubblyAddr      = "http://localhost:8111"
	DefaultNATSAddr        = "localhost:4223"
)

Default configuration for the bubbly client config

Variables

This section is empty.

Functions

func DefaultAuthConfig

func DefaultAuthConfig() *auth.Config

func DefaultEnvBool

func DefaultEnvBool(key string, defaultValue bool) bool

DefaultEnvBool reads a boolean value from the environment and falls back to the default value if not provided.

func DefaultEnvStr

func DefaultEnvStr(key, defaultValue string) string

DefaultEnvStr reads a string value from the environment and falls back to the default value if not provided.

func NewDefaultLogger

func NewDefaultLogger() zerolog.Logger

NewDefaultLogger sets up a default logger

func WithBubblyUI

func WithBubblyUI(fs *embed.FS) func(*BubblyConfig)

func WithVersion

func WithVersion(version *Version) func(*BubblyConfig)

Types

type BubblyConfig

type BubblyConfig struct {
	// UI stores the embedded bubbly frontend
	UI *embed.FS
	// Logger stores the global bubbly logger
	Logger        zerolog.Logger
	ReleaseConfig *ReleaseConfig
	ServerConfig  *ServerConfig
	// Store provider configuration
	StoreConfig  *StoreConfig
	ClientConfig *ClientConfig
	CLIConfig    *CLIConfig
	AuthConfig   *auth.Config
	Version      *Version
}

BubblyConfig holds global bubbly state that is required to be injected into functions throughout the codebase.

func NewBubblyConfig

func NewBubblyConfig(opts ...func(*BubblyConfig)) *BubblyConfig

NewBubblyConfig sets up a default Bubbly Config

func (*BubblyConfig) UpdateLogLevel

func (bCtx *BubblyConfig) UpdateLogLevel(level zerolog.Level)

UpdateLogLevel is a convenience method for updating the log level of the zerolog.Logger managed by a BubblyConfig instance

type CLIConfig

type CLIConfig struct {
	NoColor bool
	Debug   bool
}

func DefaultCLIConfig

func DefaultCLIConfig() *CLIConfig

type ClientConfig

type ClientConfig struct {
	AuthToken  string
	BubblyAddr string
	NATSAddr   string
}

func DefaultClientConfig

func DefaultClientConfig() *ClientConfig

func (*ClientConfig) GraphQL

func (c *ClientConfig) GraphQL() string

func (*ClientConfig) V1

func (c *ClientConfig) V1() string

type NATSServerConfig

type NATSServerConfig struct {
	HTTPPort int
	Port     int
}

func DefaultNATSServerConfig

func DefaultNATSServerConfig() *NATSServerConfig

DefaultNATSServerConfig creates a NATSServerConfig struct from defaults or, preferentially, from provided environment variables.

type Provider

type Provider string

Provider is a store provider.

const (
	ProviderSqlite    Provider = "sqlite"
	ProviderPostgres  Provider = "postgres"
	ProviderCockroach Provider = "cockroachdb"
)

func (Provider) String

func (_type Provider) String() string

type ReleaseConfig

type ReleaseConfig struct {
	// BubblyDir points to the .bubbly directory
	BubblyDir string
	// ReleaseSpec points to the release specification file explicitly
	// (default $BUBBLY_DIR/release.json)
	ReleaseSpec string
	// Project defines the bubbly project
	Project string
}

ReleaseConfig is a struct storing local bubbly runtime configs, such as the localtion of the .bubbly directory containing the release specification and local adapters

func DefaultReleaseConfig

func DefaultReleaseConfig() *ReleaseConfig

DefaultReleaseConfig creates a ReleaseConfig struct from defaults or, preferentially, from provided environment variables.

type ServerConfig

type ServerConfig struct {
	Port string
	Host string
	UI   bool
}

ServerConfig is a struct storing the server information.

func DefaultServerConfig

func DefaultServerConfig() *ServerConfig

DefaultServerConfig creates a ServerConfig struct from defaults or, preferentially, from provided environment variables.

func (ServerConfig) HostURL

func (s ServerConfig) HostURL() string

type StoreConfig

type StoreConfig struct {
	Provider Provider

	PostgresAddr     string
	PostgresUser     string
	PostgresPassword string
	PostgresDatabase string

	CockroachAddr     string
	CockroachUser     string
	CockroachPassword string
	CockroachDatabase string

	RetrySleep    int
	RetryAttempts int
}

StoreConfig stores the configuration of a bubbly store, used to interact with a backend database

func DefaultStoreConfig

func DefaultStoreConfig() *StoreConfig

DefaultStoreConfig creates a StoreConfig struct from defaults or, preferentially, from provided environment variables.

type Version

type Version struct {
	Commit  string
	Version string
	Date    string
}

Version contains the SHA1 value for the commit in the Bubbly Git repo from which the current running binary was built. If the commit was tagged, the tag is also included.

func NewVersionInfo

func NewVersionInfo() *Version

NewVersionInfo returns a reference to the Version structure, populated with information provided at compile time.

Jump to

Keyboard shortcuts

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