config

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init()

Init loads the config from the env and sets defaults

Types

type Auth

type Auth struct {
	Enabled                bool
	ADTenantID             string
	ADClientID             string
	ADClientSecret         string
	SessionToken           string
	AllowedIPs             []string
	AllowForwardedFor      bool
	ForwardedForTrustLevel int
	MaxAge                 int
	SecureCookies          bool
	OktaClientID           string
	OktaClientSecret       string
	OktaIssuer             string
}

Auth config

type Config

type Config struct {
	Debug        bool
	JSONLogs     bool
	Port         int
	Auth         Auth
	Database     Database
	AppURI       string
	BlockedHosts []string
	Slack        Slack
	SentryDSN    string
}

Config definition

func GetConfig

func GetConfig() Config

GetConfig returns the config

type Database

type Database struct {
	Addr     string
	Database string
	User     string
	Pass     string
}

Database config

type Slack added in v0.1.0

type Slack struct {
	Token         string
	SigningSecret string
	TeamID        string
}

Slack config

type Specification

type Specification struct {
	Debug                  bool
	JSONLogs               bool     `envconfig:"JSON_LOGS"`
	Port                   int      `default:"1323"`
	EnableAuth             bool     `envconfig:"ENABLE_AUTH"`
	AuthExpirySeconds      int      `envconfig:"AUTH_EXPIRY_SECONDS" default:"2592000"`
	SecureCookies          bool     `envconfig:"SECURE_COOKIES" default:"true"`
	ADTenantID             string   `envconfig:"AD_TENANT_ID"`
	ADClientID             string   `envconfig:"AD_CLIENT_ID"`
	ADClientSecret         string   `envconfig:"AD_CLIENT_SECRET"`
	SessionToken           string   `envconfig:"SESSION_TOKEN"`
	PostgresAddr           string   `envconfig:"POSTGRES_ADDR" default:"localhost:5432"`
	PostgresDatabase       string   `envconfig:"POSTGRES_DATABASE" default:"go"`
	PostgresUser           string   `envconfig:"POSTGRES_USER" default:"postgres"`
	PostgresPass           string   `envconfig:"POSTGRES_PASS" default:"password"`
	Hosts                  []string `required:"true"`
	BlockedHosts           []string `envconfig:"BLOCKED_HOSTS"`
	AppURI                 string   `envconfig:"APP_URI" required:"true"`
	SlackToken             string   `envconfig:"SLACK_TOKEN"`
	SlackSigningSecret     string   `envconfig:"SLACK_SIGNING_SECRET"`
	SlackTeamID            string   `envconfig:"SLACK_TEAM_ID"`
	AllowedIPs             []string `envconfig:"ALLOWED_IPS"`
	AllowForwardedFor      bool     `envconfig:"ALLOW_FORWARDED_FOR"`
	ForwardedForTrustLevel int      `envconfig:"FORWARDED_FOR_TRUST_LEVEL" default:"1"`
	SentryDSN              string   `envconfig:"SENTRY_API_DSN"`
	OktaClientID           string   `envconfig:"OKTA_CLIENT_ID"`
	OktaClientSecret       string   `envconfig:"OKTA_CLIENT_SECRET"`
	OktaIssuer             string   `envconfig:"OKTA_ISSUER"`
}

Specification definition in env

Jump to

Keyboard shortcuts

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