Documentation
¶
Index ¶
Constants ¶
const Prefix = "rtnl"
All environment variables will have this Prefix unless otherwise defined in struct tags. For example, the conf.LogLevel environment variable will be RTNL_LOG_LEVEL because of this Prefix and the split_words struct tag in the conf below.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthConfig ¶ added in v1.2.0
type AuthConfig struct {
GoogleClientID string `split_words:"true" required:"true" desc:"the Google oauth claims client id and audience"`
HDClaim string `split_words:"true" default:"rotational.io" desc:"the email domain to allow to authenticate"`
CookieDomain string `split_words:"true" default:"rtnl.link" desc:"the domain to assign cookies to"`
Keys map[string]string `required:"false" desc:"rsa keys for signing access tokens (generated if omitted)"`
Audience string `default:"https://rtnl.link" desc:"audience to add to rtnl jwt claims"`
Issuer string `default:"https://rtnl.link" desc:"issuer to add to rtnl jwt claims"`
AccessDuration time.Duration `split_words:"true" default:"1h" desc:"amount of time access tokens are valid"`
RefreshDuration time.Duration `split_words:"true" default:"2h" desc:"amount of time refresh tokens are valid"`
RefreshOverlap time.Duration `split_words:"true" default:"-15m" desc:"validity period of refresh token while access token is"`
}
type Config ¶
type Config struct {
Maintenance bool `default:"false" yaml:"maintenance"`
Mode string `default:"release"`
LogLevel logger.LevelDecoder `split_words:"true" default:"info" yaml:"log_level"`
ConsoleLog bool `split_words:"true" default:"false" yaml:"console_log"`
BindAddr string `split_words:"true" default:":8765" yaml:"bind_addr"`
AllowOrigins []string `split_words:"true" default:"http://localhost:8765"`
Origin string `default:"https://rtnl.link"`
AltOrigin string `split_words:"true" default:"https://r8l.co"`
Storage StorageConfig
Auth AuthConfig
// contains filtered or unexported fields
}
Config contains all of the configuration parameters for an rtnl server and is loaded from the environment or a configuration file with reasonable defaults for values that are omitted. The Config should be validated in preparation for running the server to ensure that all server operations work as expected.
func New ¶
New creates and processes a Config from the environment ready for use. If the configuration is invalid or it cannot be processed an error is returned.
func (Config) GetLogLevel ¶
Parse and return the zerolog log level for configuring global logging.
func (Config) IsZero ¶
A Config is zero-valued if it hasn't been processed by a file or the environment.