config

package
v0.0.0-...-87f5de6 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CSRFAuthKey

func CSRFAuthKey() string

CSRFAuthKey retrieves the APP_CSRF_AUTH_KEY value from the environment

func DBUri

func DBUri() string

DBUri retrieves the environment variable DB_URI

func ImageStoreBucketName

func ImageStoreBucketName() string

ImageStoreBucketName retrieves the APP_IMGSTORE_BUCKET_NAME value from the environment

func ImageStoreRegion

func ImageStoreRegion() string

ImageStoreRegion retrieves the APP_IMGSTORE_REGION value from the environment

func LoadAPIConfig

func LoadAPIConfig() error

LoadAPIConfig loads all of the environment configuration from environment variables. This version exists primarily to load data for the "API" / tools server

func LoadWebConfig

func LoadWebConfig() error

LoadWebConfig loads all of the environment configuration from environment variables. This version exists primarily to load data for the "Web" / UI server

func Port

func Port() string

Port retrieves the APP_PORT value from the environment

func RecoveryExpiry

func RecoveryExpiry() time.Duration

RecoveryExpiry retrieves the APP_RECOVERY_EXPIRY value from the environment

func SessionStoreKey

func SessionStoreKey() string

SessionStoreKey retrieves the SESSION_STORE_KEY value from the environment

func SupportedAuthServices

func SupportedAuthServices() []string

SupportedAuthServices retrieves the parsed AUTH_SERVICES value from the environment

Types

type AuthConfig

type AuthConfig struct {
	Services    []string
	AuthConfigs map[string]AuthInstanceConfig
}

AuthConfig provides configuration details, namespaced to

type AuthInstanceConfig

type AuthInstanceConfig struct {
	ClientID                 string `split_words:"true"`
	ClientSecret             string `split_words:"true"`
	Issuer                   string `split_words:"true"`
	BackendURL               string `split_words:"true"`
	SuccessRedirectURL       string `split_words:"true"`
	FailureRedirectURLPrefix string `split_words:"true"`
	ProfileToShortnameField  string `split_words:"true"`
}

AuthInstanceConfig provides all of the _possible_ configuration values for an auth instance. Note: it is expected that not all fields will be populated. It is up to the user to verify that these fields exist and have correct values

func AuthConfigInstance

func AuthConfigInstance(name string) AuthInstanceConfig

AuthConfigInstance attempts to retrieve a particular auth configuration set from the environment. Note this looks for environment variables prefixed with AUTH_${SERVICE_NAME}, and will only retrieve these values for services named in the AUTH_SERVICES environment

type DBConfig

type DBConfig struct {
	URI string `required:"true"`
}

DBConfig provides configuration details on connecting to the backend database

type WebConfig

type WebConfig struct {
	ImgstoreBucketName string        `split_words:"true"`
	ImgstoreRegion     string        `split_words:"true"`
	CsrfAuthKey        string        `split_words:"true"`
	SessionStoreKey    string        `split_words:"true"`
	RecoveryExpiry     time.Duration `split_words:"true" default:"24h"`
	Port               int
}

WebConfig is a namespaced app-specific configuration.

Jump to

Keyboard shortcuts

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