Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrPopulatedMissing = errors.New("populated missing secrets")
ErrPopulatedMissing can be returned by New to signal that missing values have been populated and persisted.
var ( // EventRetention defines the duration for which events are expected to // be kept before expired. This value can be overridden by setting OFFEN_APP_RETENTION_DAYS EventRetention = time.Hour * 24 * 6 * 31 )
var Revision string
Revision will be set by ldflags on build time
Functions ¶
func ExpandString ¶
ExpandString expands all environment variables in the given string
Types ¶
type Bytes ¶
type Bytes []byte
Bytes is a byte slice.
type Config ¶
type Config struct { Server struct { Port int `default:"3000"` ReverseProxy bool `default:"false"` SSLCertificate EnvString SSLKey EnvString AutoTLS []string LetsEncryptEmail string CertificateCache EnvString `default:"/var/www/.cache"` } Database struct { Dialect Dialect `default:"sqlite3"` ConnectionString EnvString `default:"/var/opt/offen/offen.db"` ConnectionRetries int `default:"0"` } App struct { Development bool `default:"false"` LogLevel LogLevel `default:"info"` SingleNode bool `default:"true"` Locale Locale `default:"en"` RootAccount string DemoAccount string `ignored:"true"` DeployTarget DeployTarget Retention Retention `default:"6months"` } Secret Bytes SMTP struct { Authtype string `default:"LOGIN"` User string Password string Host string Port int `default:"587"` Sender string `default:"no-reply@offen.dev"` } }
Config contains all runtime configuration needed for running offen as and also defines the desired defaults. Package envconfig is used to source values from the application environment at runtime.
func (*Config) NewMailer ¶
NewMailer returns a new mailer that is suitable for the given config. In development, mail content will be printed to stdout. In production, SMTP is preferred and falls back to sendmail if no SMTP credentials are given.
func (*Config) SMTPConfigured ¶
SMTPConfigured returns true if a SMTP Host is configured
type DeployTarget ¶
type DeployTarget string
DeployTarget identifies a known deploy target.
const (
DeployTargetHeroku DeployTarget = "heroku"
)
this defines all the known deploy targets that have defined exceptions for generating a runtime config.
func (*DeployTarget) Decode ¶
func (d *DeployTarget) Decode(v string) error
Decode validates and assigns v.
func (*DeployTarget) String ¶
func (d *DeployTarget) String() string
type EnvString ¶
type EnvString string
EnvString is a string that expands environemt variables