config

package
v0.0.0-...-d0162ed Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// File Filesystem YAML based configuration.
	DefaultSelfApp *SelfAppConfig
	// OPTIONAL based configuration
	// RefreshTokenExpiration JWT refresh expiration in hours.
	RefreshTokenExpirationInHours int `env:"REFRESH_TOKEN_EXPIRATION"`
	// JWTExpiration JWT expiration in hours.
	JWTExpirationTimeInHours int `env:"JWT_EXPIRATION_TIME_IN_HOURS"`
	// ServeDocs string _(true|false)_ defining if docs should be served from the localhost on "/docs" path.
	ServeDocs string `env:"SERVE_DOCS"`
	// ServerPort the server port. Defaults to 8080
	ServerPort int `env:"SERVER_PORT"`
	// DefaultAppCallbackURL the default callback url for any incoming messages.
	DefaultAppCallbackURL string `env:"APP_MESSAGE_NOTIFICATION_URL"`
	// REQUIRED ENV based configuration
	// JWTSigningKey The signing key used to build the jwt tokens shared with the api clients.
	JWTSigningKey string `env:"JWT_SIGNING_KEY"`
	// User The default user used on the authentication endpoints.
	User string `env:"USER"`
	// Password The default password used on the authentication endpoints.
	Password string `env:"PASSWORD"`
	// StorageDir The default user used on the authentication endpoints.
	StorageDir string `env:"STORAGE_DIR"`
	// StorageKey The default storage key used to encrypt sessions.
	StorageKey string `env:"STORAGE_KEY"`
	// DefaultAppID the default self app identifier.
	DefaultAppID string `env:"APP_ID"`
	// DefaultAppSecret the default self app secret.
	DefaultAppSecret string `env:"APP_SECRET"`
	// DefaultAppEnv the default self app environment.
	DefaultAppEnv string `env:"APP_ENV"`
	// CleanupPeriod the number of days the database temporary data will be removed.
	CleanupPeriod int `env:"CLEANUP_PERIOD"`
}

Config represents an application configuration.

func Load

func Load(logger log.Logger, envPath string) (*Config, error)

Load returns an application configuration which is populated from the given configuration file and environment variables.

func (Config) Validate

func (c Config) Validate() error

Validate validates the application configuration.

type SelfAppConfig

type SelfAppConfig struct {
	SelfAppID           string `yaml:"self_app_id"`
	SelfAppDeviceSecret string `yaml:"self_device_secret"`
	SelfStorageKey      string `yaml:"self_storage_key"`
	SelfStorageDir      string `yaml:"self_storage_dir"`
	SelfEnv             string `yaml:"self_env"`
	SelfAPIURL          string `yaml:"self_api_url"`
	SelfMessagingURL    string `yaml:"self_messaging_url"`
	CallbackURL         string `yaml:"message_notification_url"`
	DLCode              string `yaml:"dl_code" env:"DL_CODE"`
}

Self config object

Jump to

Keyboard shortcuts

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