config

package
v0.0.0-...-8444db5 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2022 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const ServiceName service.Name = "config"

Variables

This section is empty.

Functions

func Dump

func Dump(config *Config, w io.Writer) error

func ServiceProvider

func ServiceProvider(config *Config) service.Provider

func WithConfig

func WithConfig(ctx context.Context, conf *Config) context.Context

func WithEnvironment

func WithEnvironment(conf *Config) error

Types

type ARPWatcherConfig

type ARPWatcherConfig struct {
	RouterIP        string        `yaml:"routerIp"`
	RouterNetwork   string        `yaml:"routerNetwork"`
	HostIP          string        `yaml:"hostIp"`
	NIC             string        `yaml:"nic"`
	OfflineDeadline time.Duration `yaml:"offlineDeadline"`
	ProbeInterval   time.Duration `yaml:"probeInterval"`
	PurgeDeadline   time.Duration `yaml:"purgeDeadline"`
}

type AppConfig

type AppConfig struct {
	SearchPatterns    []string `yaml:"searchPatterns" env:"ARCAD_APP_SEARCH_PATTERNS"`
	DataDir           string   `yaml:"dataDir" env:"ARCAD_APP_DATA_DIR"`
	MaxFileUploadSize int64    `yaml:"maxFileUploadSize" env:"ARCAD_APP_MAX_FILE_UPLOAD_SIZE"`
}

type CaptivePortalConfig

type CaptivePortalConfig struct {
	Enabled     bool               `yaml:"enabled" env:"ARCAD_CAPTIVE_PORTAL_ENABLED"`
	RedirectURL string             `yaml:"redirectUrl" env:"ARCAD_CAPTIVE_PORTAL_REDIRECT_URL"`
	ARPWatcher  []ARPWatcherConfig `yaml:"arpWatchers"`
}

type ClockSyncConfig

type ClockSyncConfig struct {
	Enabled bool     `yaml:"enabled" env:"ARCAD_CLOCK_SYNC_ENABLED"`
	Format  string   `yaml:"format" env:"ARCAD_CLOCK_SYNC_FORMAT"`
	Command []string `yaml:"command" env:"ARCAD_CLOCK_SYNC_COMMAND"`
}

type Config

type Config struct {
	Debug         bool                              `yaml:"debug" env:"ARCAD_DEBUG"`
	HTTP          HTTPConfig                        `yaml:"http"`
	Contact       ContactConfig                     `yaml:"contact"`
	App           AppConfig                         `yaml:"app"`
	Data          DataConfig                        `yaml:"data"`
	MemberCard    MemberCardConfig                  `yaml:"memberCard"`
	Job           JobConfig                         `yaml:"job"`
	Log           LogConfig                         `yaml:"log"`
	Sentry        SentryConfig                      `yaml:"sentry"`
	Theme         ThemeConfig                       `yaml:"theme"`
	ClockSync     ClockSyncConfig                   `yaml:"clockSync"`
	CaptivePortal CaptivePortalConfig               `yaml:"captivePortal"`
	GatewayServer GatewayServerConfig               `yaml:"gatewayServer"`
	GatewayClient GatewayClientConfig               `yaml:"gatewayClient"`
	TunnelServer  TunnelServerConfig                `yaml:"tunnelServer"`
	TunnelClient  TunnelClientConfig                `yaml:"tunnelClient"`
	MarketClient  MarketClientConfig                `yaml:"marketClient"`
	Plugins       map[string]map[string]interface{} `yaml:"plugins"`
}

func From

func From(container *service.Container) (*Config, error)

From retrieves the config service in the given container

func FromContext

func FromContext(ctx context.Context) (*Config, error)

FromContext retrieves the config service in the given context.

func Must

func Must(container *service.Container) *Config

Must retrieves the config service in the given container or panic otherwise

func MustContext

func MustContext(ctx context.Context) *Config

MustContext retrieves the config service in the given context or panic otherwise.

func NewDefault

func NewDefault() *Config

func NewFromFile

func NewFromFile(filepath string) (*Config, error)

NewFromFile retrieves the configuration from the given file

type ContactConfig

type ContactConfig struct {
	Email   string `yaml:"email" env:"ARCAD_CONTACT_EMAIL"`
	Subject string `yaml:"subject" env:"ARCAD_CONTACT_SUBJECT"`
}

type DataConfig

type DataConfig struct {
	DBPath string `yaml:"dbPath" env:"ARCAD_DATA_DB_PATH"`
}

type GatewayCacheConfig

type GatewayCacheConfig struct {
	Enabled        bool          `yaml:"enabled" env:"ARCAD_GATEWAY_SERVER_CACHE_ENABLED"`
	MaxSize        int64         `yaml:"maxSize" env:"ARCAD_GATEWAY_SERVER_CACHE_MAX_SIZE"`
	TTL            time.Duration `yaml:"ttl" env:"ARCAD_GATEWAY_SERVER_CACHE_TTL"`
	RefreshTimeout time.Duration `yaml:"refreshTimeout" env:"ARCAD_GATEWAY_SERVER_CACHE_REFRESH_TIMEOUT"`
}

type GatewayClientConfig

type GatewayClientConfig struct {
	ServerAddress    string        `yaml:"serverAddress" env:"ARCAD_GATEWAY_CLIENT_SERVER_ADDRESS"`
	ID               string        `yaml:"id" env:"ARCAD_GATEWAY_CLIENT_ID"`
	Secret           string        `yaml:"secret" env:"ARCAD_GATEWAY_CLIENT_SECRET"`
	SharedSecret     string        `yaml:"sharedSecret" env:"ARCAD_GATEWAY_CLIENT_SHARED_SECRET"`
	SharedSalt       string        `yaml:"sharedSalt" env:"ARCAD_GATEWAY_CLIENT_SHARED_SALT"`
	BackoffBaseDelay time.Duration `yaml:"backoffBaseDelay" env:"ARCAD_GATEWAY_CLIENT_BACKOFF_BASE_DELAY"`
	BackoffFactor    float32       `yaml:"backoffFactor" env:"ARCAD_GATEWAY_CLIENT_BACKOFF_FACTOR"`
}

type GatewayRemoteClientConfig

type GatewayRemoteClientConfig struct {
	ID     string `yaml:"id"`
	Secret string `yaml:"secret"`
	Match  string `yaml:"match"`
}

type GatewayServerConfig

type GatewayServerConfig struct {
	TunnelAddress  string                      `yaml:"tunnelAddress" env:"ARCAD_GATEWAY_SERVER_TUNNEL_ADDRESS"`
	HTTPAddress    string                      `yaml:"httpAddress" env:"ARCAD_GATEWAY_SERVER_HTTP_ADDRESS"`
	SharedSecret   string                      `yaml:"sharedSecret" env:"ARCAD_GATEWAY_SERVER_SHARED_SECRET"`
	SharedSalt     string                      `yaml:"sharedSalt" env:"ARCAD_GATEWAY_SERVER_SHARED_SALT"`
	ProxyTargetURL string                      `yaml:"proxyTargetUrl" env:"ARCAD_GATEWAY_SERVER_PROXY_TARGET_URL"`
	MatchRegExp    string                      `yaml:"matchRegExp" env:"ARCAD_GATEWAY_SERVER_MATCH_REGEXP"`
	Cache          GatewayCacheConfig          `yaml:"cache"`
	Clients        []GatewayRemoteClientConfig `yaml:"clients"`
}

type HTTPConfig

type HTTPConfig struct {
	Address                 string `yaml:"address" env:"ARCAD_HTTP_ADDRESS"`
	TemplateDir             string `yaml:"templateDir" env:"ARCAD_HTTP_TEMPLATE_DIR"`
	PublicDir               string `yaml:"publicDir" env:"ARCAD_HTTP_PUBLIC_DIR"`
	CookieAuthenticationKey string `yaml:"cookieAuthenticationKey" env:"ARCAD_HTTP_COOKIE_AUTHENTICATION_KEY"`
	CookieEncryptionKey     string `yaml:"cookieEncryptionKey" env:"ARCAD_HTTP_COOKIE_ENCRYPTION_KEY"`
	CookieMaxAge            int    `yaml:"cookieMaxAge" env:"ARCAD_HTTP_COOKIE_MAX_AGE"`
}

type JobConfig

type JobConfig struct {
	CleanupSpec string `yaml:"cleanupSpec" env:"ARCAD_JOB_CLEANUP_SPEC"`
}

type LogConfig

type LogConfig struct {
	Format logger.Format `yaml:"format" env:"ARCAD_LOG_FORMAT"`
	Level  logger.Level  `yaml:"level" env:"ARCAD_LOG_LEVEL"`
}

type MarketClientConfig

type MarketClientConfig struct {
	MarketURL      string        `yaml:"marketUrl" env:"ARCAD_MARKET_CLIENT_MARKET_URL"`
	IPFSGatewayURL string        `yaml:"ipfsGatewayUrl" env:"ARCAD_MARKET_CLIENT_IPFS_GATEWAY_URL"`
	Timeout        time.Duration `yaml:"timeout" env:"ARCAD_MARKET_CLIENT_TIMEOUT"`
	RetryMax       int           `yaml:"retryMax" env:"ARCAD_MARKET_CLIENT_RETRY_MAX"`
	AppsDir        string        `yaml:"appsDir" env:"ARCAD_MARKET_CLIENT_APPS_DIR"`
}

type MemberCardConfig

type MemberCardConfig struct {
	SigningKeyPath      string  `yaml:"signingKeyPath" env:"ARCAD_MEMBER_CARD_SIGNING_KEY_PATH"`
	LayoutPath          string  `yaml:"layoutPath" env:"ARCAD_MEMBER_CARD_LAYOUT_PATH"`
	FontPath            string  `yaml:"fontPath" env:"ARCAD_MEMBER_CARD_FONT_PATH"`
	NicknameFontSize    float64 `yaml:"nicknameFontSize" env:"ARCAD_MEMBER_CARD_NICKNAME_FONT_SIZE"`
	NicknameAnchorX     float64 `yaml:"nicknameAnchorX" env:"ARCAD_MEMBER_CARD_NICKNAME_ANCHOR_X"`
	NicknameAnchorY     float64 `yaml:"nicknameAnchorY" env:"ARCAD_MEMBER_CARD_NICKNAME_ANCHOR_Y"`
	NicknameLineSpacing float64 `yaml:"nicknameLineSpacing" env:"ARCAD_MEMBER_CARD_NICKNAME_LINE_SPACING"`
}

type SentryConfig

type SentryConfig struct {
	DSN             string  `yaml:"dsn" env:"ARCAD_SENTRY_DSN"`
	Environment     string  `yaml:"environment" env:"ARCAD_SENTRY_ENVIRONMENT"`
	TraceSampleRate float64 `yaml:"traceSampleRate" env:"ARCAD_SENTRY_TRACE_SAMPLE_RATE"`
}

type ThemeConfig

type ThemeConfig struct {
	Path string `yaml:"path" env:"ARCAD_THEME_PATH"`
}

func (*ThemeConfig) EmptyPath

func (c *ThemeConfig) EmptyPath() bool

func (*ThemeConfig) ThemedDirectories

func (c *ThemeConfig) ThemedDirectories(themeSubDir string, dirs ...string) []string

ThemedDirectories returns a slice of directories with the theme subdirectory appended if a theme is defined in the configuration.

type TunnelClientConfig

type TunnelClientConfig struct {
	ServerAddress    string        `yaml:"serverAddress" env:"ARCAD_TUNNEL_CLIENT_SERVER_ADDRESS"`
	ID               string        `yaml:"id" env:"ARCAD_TUNNEL_CLIENT_ID"`
	Secret           string        `yaml:"secret" env:"ARCAD_TUNNEL_CLIENT_SECRET"`
	SharedSecret     string        `yaml:"sharedSecret" env:"ARCAD_TUNNEL_CLIENT_SHARED_SECRET"`
	SharedSalt       string        `yaml:"sharedSalt" env:"ARCAD_TUNNEL_CLIENT_SHARED_SALT"`
	BackoffBaseDelay time.Duration `yaml:"backoffBaseDelay" env:"ARCAD_TUNNEL_CLIENT_BACKOFF_BASE_DELAY"`
	BackoffFactor    float32       `yaml:"backoffFactor" env:"ARCAD_TUNNEL_CLIENT_BACKOFF_FACTOR"`
}

type TunnelRemoteClientConfig

type TunnelRemoteClientConfig struct {
	ID     string `yaml:"id"`
	Secret string `yaml:"secret"`
}

type TunnelServerConfig

type TunnelServerConfig struct {
	TunnelAddress         string                     `yaml:"tunnelAddress" env:"ARCAD_TUNNEL_SERVER_TUNNEL_ADDRESS"`
	SharedSecret          string                     `yaml:"sharedSecret" env:"ARCAD_TUNNEL_SERVER_SHARED_SECRET"`
	SharedSalt            string                     `yaml:"sharedSalt" env:"ARCAD_TUNNEL_SERVER_SHARED_SALT"`
	ProxyTargetAddress    string                     `yaml:"proxyTargetAddress" env:"ARCAD_TUNNEL_SERVER_PROXY_TARGET_ADDRESS"`
	Clients               []TunnelRemoteClientConfig `yaml:"clients"`
	SocketDir             string                     `yaml:"socketDir" env:"ARCAD_TUNNEL_SERVER_SOCKET_DIR"`
	SocketFilenamePattern string                     `yaml:"socketFilenamePattern" env:"ARCAD_TUNNEL_SERVER_SOCKET_FILENAME_PATTERN"`
}

Jump to

Keyboard shortcuts

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