config

package
v0.0.0-...-0bb06ad Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	AppEnv      string `json:"app_env" envconfig:"APP_ENV"`
	AppName     string `json:"app_name" envconfig:"APP_NAME"`
	ConfigOauth ConfigOauth
}

type Config

type Config struct {
	App AppConfig
}
var BaseConfig *Config

func LoadConfig

func LoadConfig() *Config

type ConfigOauth

type ConfigOauth struct {
	Oauth         OauthConfig
	Session       SessionConfig
	IsDevelopment bool
}

Config stores all configuration options

type OauthConfig

type OauthConfig struct {
	AccessTokenLifetime  int `json:"access_token_lifetime" envconfig:"OAUTH_ACCESS_TOKEN_LIFETIME"`
	RefreshTokenLifetime int `json:"refresh_token_lifetime" envconfig:"OAUTH_REFRESH_TOKEN_LIFETIME"`
	AuthCodeLifetime     int `json:"auth_code_lifetime" envconfig:"OAUTH_AUTH_CODE_LIFETIME"`
}

OauthConfig stores oauth service configuration options

type SessionConfig

type SessionConfig struct {
	Secret string `json:"secret" envconfig:"SESSION_SECRET"`
	Path   string `json:"path" envconfig:"SESSION_PATH"`
	// MaxAge=0 means no 'Max-Age' attribute specified.
	// MaxAge<0 means delete cookie now, equivalently 'Max-Age: 0'.
	// MaxAge>0 means Max-Age attribute present and given in seconds.
	MaxAge int `json:"max_age" envconfig:"SESSION_MAX_AGE"`
	// When you tag a cookie with the HttpOnly flag, it tells the browser that
	// this particular cookie should only be accessed by the server.
	// Any attempt to access the cookie from client script is strictly forbidden.
	HTTPOnly bool `json:"http_only" envconfig:"SESSION_HTTP_ONLY"`
}

SessionConfig stores session configuration for the web app

Jump to

Keyboard shortcuts

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