config

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

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AppName = libConfig.AppName
	EnvName = libConfig.EnvName

	HTTPBindAddress = libHttp.HTTPBindAddress
	HTTPBindPort    = libHttp.HTTPBindPort

	BaseURL = "base-url"

	CasbinModel  = "casbin-model"
	CasbinPolicy = "casbin-policy"

	CookiesEnabled = "cookies-enabled"
	CookiesDomain  = "cookies-domain"

	CSRFEnabled      = "csrf-enabled"
	CSRFCookieDomain = "csrf-cookie-domain"
	CSRFCookieName   = "csrf-cookie-name"
	CSRFHeaderName   = "csrf-header-name"
	CSRFSecretKey    = "csrf-secret-key"

	JWTAccessTokenCookieName  = "jwt-access-token-cookie-name"
	JWTAccessTokenExpiry      = "jwt-access-token-expiry"
	JWTIssuer                 = "jwt-issuer"
	JWTPrivateKey             = "jwt-private-key"
	JWTRefreshTokenCookieName = "jwt-refresh-token-cookie-name"
	JWTRefreshTokenExpiry     = "jwt-refresh-token-expiry"

	OAuth2Providers = "oauth2-providers"

	OAuth2GoogleClientId     = "oauth2-google-client-id"
	OAuth2GoogleClientSecret = "oauth2-google-client-secret"

	OpenAPISchema = "openapi-schema"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CSRF

type CSRF struct {
	Enabled      bool
	SecretKey    string
	CookieName   string
	CookieDomain string
	HeaderName   string
}

type Casbin

type Casbin struct {
	Model  string
	Policy string
}

type Config

type Config struct {
	Config  *libConfig.Config
	HTTP    *libHttp.Config
	Logging *libLog.Config
	MongoDB *libMongo.Config

	BaseURL string

	Casbin       *Casbin
	Cookies      *Cookies
	CSRF         *CSRF
	JWT          *JWT
	OAuth2       *OAuth2
	OAuth2Google *OAuth2Google
	OpenAPI      *OpenAPI
}

Config holds all configuration for our program

func New

func New() *Config

New creates a Config instance

func (*Config) BindFlags

func (c *Config) BindFlags()

type Cookies

type Cookies struct {
	Enabled bool
	Domain  string
}

type JWT

type JWT struct {
	AccessTokenExpiry      time.Duration
	AccessTokenCookieName  string
	RefreshTokenExpiry     time.Duration
	RefreshTokenCookieName string
	PrivateKey             string
	Issuer                 string
}

type OAuth2

type OAuth2 struct {
	Providers []string
}

type OAuth2Google

type OAuth2Google struct {
	ClientId     string
	ClientSecret string
}

type OpenAPI

type OpenAPI struct {
	Schema string
}

Jump to

Keyboard shortcuts

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