config

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAppName

func GetAppName() string

GetAppName gets the name for the app.

func GetAppRoot

func GetAppRoot() string

GetAppRoot gets the app root directory for the application.

func GetDataAdapter added in v1.1.0

func GetDataAdapter() string

GetDataAdapter gets the data adapter currently selected for the app.

func InitConfig

func InitConfig(dir string) error

InitConfig sets the default config values and binds environment variables. Should be called at the start of the application.

Types

type Config

type Config struct {
	// AppName is a client facing name to refer to the app as.
	AppName string `yaml:"app_name"`

	// DataAdapter is the name of the data adapter the app will use.
	DataAdapter string `yaml:"data_adapter,omitempty"`

	TokenConfig            TokenConfig            `yaml:"token"`
	PermissionConfig       PermissionConfig       `yaml:"permissions"`
	DatabaseConfig         DatabaseConfig         `yaml:"database,omitempty"`
	FirestoreConfig        FirestoreConfig        `yaml:"firestore,omitempty"`
	PasswordCriteriaConfig PasswordCriteriaConfig `yaml:"password_criteria"`
}

type DatabaseConfig

type DatabaseConfig struct {
	// Driver is the database driver to use.
	Driver string `yaml:"driver"`

	// ConnectionStrings is a string map that maps db keys to the connection string of the database.
	ConnectionStrings map[string]string `yaml:"connection_strings"`

	// Timeout is the default timeout all database requests should use.
	Timeout int `yaml:"timeout"`
}

func GetDatabaseConfig

func GetDatabaseConfig() DatabaseConfig

GetDatabaseConfig gets the database config object.

type FirestoreConfig added in v1.1.0

type FirestoreConfig struct {
	// ServiceFile is the file location for the firebase service account json.
	ServiceFile string `yaml:"service_file,omitempty"`

	// Timeout is the default timeout all firestore requests should use.
	Timeout int `yaml:"timeout"`
}

func GetFirestoreConfig added in v1.1.0

func GetFirestoreConfig() FirestoreConfig

GetFirestoreConfig gets the firestore config object.

type PasswordCriteriaConfig

type PasswordCriteriaConfig struct {
	// MinLength is the minimum length the password must be.
	MinLength int `yaml:"min_length"`

	// RequireLowerCase determines if at least one lower case letter must be present.
	RequireLowerCase bool `yaml:"require_lower_case"`

	// RequireUpperCase determines if at least one upper case letter must be present.
	RequireUpperCase bool `yaml:"require_upper_case"`

	// RequireDigit determines if at least one digit must be present.
	RequireDigit bool `yaml:"require_digit"`

	// RequireSymbol determines if at least one symbol must be present.
	RequireSymbol bool `yaml:"require_symbol"`
}

func GetPasswordCriteriaConfig

func GetPasswordCriteriaConfig() PasswordCriteriaConfig

GetPasswordCriteriaConfig gets the password criteria config object.

type PermissionConfig

type PermissionConfig struct {
	// MinClientRank is the minimum rank a user must have to manage clients.
	MinClientRank int `yaml:"min_client_rank"`
}

func GetPermissionConfig

func GetPermissionConfig() PermissionConfig

GetPermissionConfig gets the permissions config object.

type TokenConfig

type TokenConfig struct {
	// DefaultIssuer is the the value that will go in the "issuer" field for default tokens.
	DefaultIssuer string `yaml:"default_issuer"`

	// Lifetime is the length of time a token will be valid for.
	Lifetime int64 `yaml:"lifetime"`
}

func GetTokenConfig

func GetTokenConfig() TokenConfig

GetTokenConfig gets the token config object.

Jump to

Keyboard shortcuts

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