config

package
v0.0.0-...-efeff4c Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyENV         = "ENV"
	KeyTimeOut     = "TIME_OUT"
	KeyLogLevel    = "LOG_LEVEL"
	KeyLogOutput   = "LOG_OUTPUT"
	KeyHostname    = "HOSTNAME"
	KeyHTTPS       = "HTTPS"
	KeyCertPath    = "CERT_PATH"
	KeyKeyPath     = "KEY_PATH"
	KeyListen      = "LISTEN"
	KeyStorage     = "STORAGE"
	KeyStoragePath = "STORAGE_PATH"

	StorageFS     = "fs"
	StorageBoltDB = "boltdb"
	StorageBadger = "badger"
	StorageSqlite = "sqlite"
)
View Source
const DefaultStorage = StorageFS

Variables

View Source
var Prefix = "auth"
View Source
var ValidEnvs = []Env{PROD, DEV, TEST}

Functions

func Getval

func Getval(name, def string) string

func ParseStorageDSN

func ParseStorageDSN(s string) (string, string)

func Storage

func Storage(c StorageConfig, env Env, l lw.Logger) (authorize.FullStorage, error)

func ValidEnv

func ValidEnv(s string) bool

func ValidStorageType

func ValidStorageType(typ string) bool

Types

type BackendConfig

type BackendConfig struct {
	Enabled bool
	Host    string
	Port    int64
	User    string
	Pw      string
	Name    string
}

type Env

type Env string
const (
	PROD Env = "prod"
	DEV  Env = "dev"
	TEST Env = "test"
)

func (Env) IsProd

func (e Env) IsProd() bool

type Options

type Options struct {
	Env       Env
	LogLevel  lw.Level
	LogOutput string
	TimeOut   time.Duration
	Secure    bool
	CertPath  string
	KeyPath   string
	Host      string
	Listen    string
	Storage   StorageConfig
}

func LoadFromEnv

func LoadFromEnv(e Env, timeOut time.Duration) (Options, error)

type StorageConfig

type StorageConfig struct {
	Type string
	Path string
}

type StorageType

type StorageType string

Jump to

Keyboard shortcuts

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