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"` // $TENANT_MAINTENANCE BindAddr string `split_words:"true" default:":8088"` // $TENANT_BIND_ADDR Mode string `default:"release"` // $TENANT_MODE LogLevel logger.LevelDecoder `split_words:"true" default:"info"` // $TENANT_LOG_LEVEL ConsoleLog bool `split_words:"true" default:"false"` // $TENANT_CONSOLE_LOG AllowOrigins []string `split_words:"true" default:"http://localhost:3000"` // $TENANT_ALLOW_ORIGINS Database DatabaseConfig `split_words:"true"` SendGrid SendGridConfig `split_words:"false"` Sentry sentry.Config // contains filtered or unexported fields }
Config uses envconfig to load required settings from the environment, parses and validates them, and loads defaults where necessary in preparation for running the Tenant API service. This is the top-level config, any sub configurations will 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 ¶ added in v0.1.1
type DatabaseConfig struct { URL string `default:"trtl://localhost:4436"` Insecure bool `default:"true"` CertPath string `split_words:"true"` PoolPath string `split_words:"true"` Testing bool `default:"false"` }
Configures the connection to trtl for replicated data storage.
func (DatabaseConfig) Endpoint ¶ added in v0.1.1
func (c DatabaseConfig) Endpoint() (_ string, err error)
func (DatabaseConfig) Validate ¶ added in v0.1.1
func (c DatabaseConfig) Validate() (err error)
If not insecure, the cert and pool paths are required.
type SendGridConfig ¶
type SendGridConfig struct { APIKey string `split_words:"true" required:"false"` FromEmail string `split_words:"true" default:"ensign@rotational.io"` AdminEmail string `split_words:"true" default:"admins@rotational.io"` EnsignListID string `split_words:"true" required:"false"` }
Configures the email and marketing contact APIs for use with the Tenant server.
func (SendGridConfig) Enabled ¶
func (c SendGridConfig) Enabled() bool
Returns true if there is a SendGrid API key available
func (SendGridConfig) Validate ¶
func (c SendGridConfig) Validate() error
The from and admin emails are required if the SendGrid API is enabled.