Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Maintenance bool `default:"false"` // $QUARTERDECK_MAINTENANCE
BindAddr string `split_words:"true" default:":8088"` // $QUARTERDECK_BIND_ADDR
Mode string `default:"release"` // $QUARTERDECK_MODE
LogLevel logger.LevelDecoder `split_words:"true" default:"info"` // $QUARTERDECK_LOG_LEVEL
ConsoleLog bool `split_words:"true" default:"false"` // $QUARTERDECK_CONSOLE_LOG
AllowOrigins []string `split_words:"true" default:"http://localhost:3000"` // $QUARTERDECK_ALLOW_ORIGINS
Database DatabaseConfig
Token TokenConfig
Sentry sentry.Config
// contains filtered or unexported fields
}
Config uses envconfig to load the required settings from the environment, parse and validate them, loading defaults where necessary in preparation for running the Quarterdeck API service. This is the top-level config, all sub configurations need to be defined as properties of this Config.
func New ¶
New loads and parses the config from the environment and validates it, marking it as processed so that external users can determine if the config is ready for use. This should be the only way Config objects are created for use in the application.
func (Config) AllowAllOrigins ¶
Returns true if the allow origins slice contains one entry that is a "*"
func (Config) GetLogLevel ¶
func (Config) IsZero ¶
Returns true if the config has not been correctly processed from the environment.
type DatabaseConfig ¶
type TokenConfig ¶
type TokenConfig struct {
Keys map[string]string `required:"false"` // $QUARTERDECK_TOKEN_KEYS
Audience string `default:"ensign.rotational.app:443"` // $QUARTERDECK_TOKEN_AUDIENCE
Issuer string `default:"https://auth.rotational.app"` // $QUARTERDECK_TOKEN_ISSUER
AccessDuration time.Duration `split_words:"true" default:"1h"` // $QUARTERDECK_TOKEN_ACCESS_DURATION
RefreshDuration time.Duration `split_words:"true" default:"2h"` // $QUARTERDECK_TOKEN_REFRESH_DURATION
RefreshOverlap time.Duration `split_words:"true" default:"-15m"` // $QUARTERDECK_TOKEN_REFRESH_OVERLAP
}