config

package
v0.0.0-...-e81234b Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Value

func Value(val string) (string, error)

Value returns the config value based on a DSN.

Types

type Admin

type Admin struct {
	Create   bool   `mapstructure:"create"`
	Username string `mapstructure:"username"`
	Password string `mapstructure:"password"`
	Email    string `mapstructure:"email"`
}

Admin defines the initial admin user configuration.

type Auth

type Auth struct {
	Config string `mapstructure:"config"`
}

Auth defines the authentication configuration.

type AuthAdmins

type AuthAdmins struct {
	Users  []string `mapstructure:"users"`
	Emails []string `mapstructure:"emails"`
	Roles  []string `mapstructure:"roles"`
}

AuthAdmins defines the mappings for administrative users.

type AuthConfig

type AuthConfig struct {
	Providers []AuthProvider `mapstructure:"providers"`
}

AuthConfig defines the configuration for auth sources.

type AuthEndpoints

type AuthEndpoints struct {
	Issuer  string `mapstructure:"issuer"`
	Auth    string `mapstructure:"auth"`
	Token   string `mapstructure:"token"`
	Profile string `mapstructure:"profile"`
	Email   string `mapstructure:"email"`
}

AuthEndpoints defines the endpoints for external authentication.

type AuthMappings

type AuthMappings struct {
	Login string `mapstructure:"login"`
	Name  string `mapstructure:"name"`
	Email string `mapstructure:"email"`
	Role  string `mapstructure:"role"`
}

AuthMappings defines the mappings for external authentication.

type AuthProvider

type AuthProvider struct {
	Driver       string        `mapstructure:"driver"`
	Name         string        `mapstructure:"name"`
	Display      string        `mapstructure:"display"`
	Icon         string        `mapstructure:"icon"`
	Callback     string        `mapstructure:"callback"`
	ClientID     string        `mapstructure:"client_id"`
	ClientSecret string        `mapstructure:"client_secret"`
	Verifier     string        `mapstructure:"verifier"`
	Tenant       string        `mapstructure:"tenant"`
	Scopes       []string      `mapstructure:"scopes"`
	Endpoints    AuthEndpoints `mapstructure:"endpoints"`
	Mappings     AuthMappings  `mapstructure:"mappings"`
	Admins       AuthAdmins    `mapstructure:"admins"`
}

AuthProvider defines a single provider auth source.

type Config

type Config struct {
	Server   Server   `mapstructure:"server"`
	Metrics  Metrics  `mapstructure:"metrics"`
	Logs     Logs     `mapstructure:"log"`
	Auth     Auth     `mapstructure:"auth"`
	Database Database `mapstructure:"database"`
	Upload   Upload   `mapstructure:"upload"`
	Token    Token    `mapstructure:"token"`
	Scim     Scim     `mapstructure:"scim"`
	Admin    Admin    `mapstructure:"admin"`
}

Config is a combination of all available configurations.

func Load

func Load() *Config

Load initializes a default configuration struct.

type Database

type Database struct {
	Driver   string            `mapstructure:"driver"`
	Address  string            `mapstructure:"address"`
	Port     string            `mapstructure:"port"`
	Username string            `mapstructure:"username"`
	Password string            `mapstructure:"password"`
	Name     string            `mapstructure:"name"`
	Options  map[string]string `mapstructure:"options"`
}

Database defines the database configuration.

type Logs

type Logs struct {
	Level  string `mapstructure:"level"`
	Pretty bool   `mapstructure:"pretty"`
	Color  bool   `mapstructure:"color"`
}

Logs defines the level and color for log configuration.

type Metrics

type Metrics struct {
	Addr  string `mapstructure:"addr"`
	Token string `mapstructure:"token"`
	Pprof bool   `mapstructure:"pprof"`
}

Metrics defines the metrics server configuration.

type Scim

type Scim struct {
	Enabled bool   `mapstructure:"enabled"`
	Token   string `mapstructure:"token"`
}

Scim defines the scim provisioning configuration.

type Server

type Server struct {
	Addr      string `mapstructure:"addr"`
	Host      string `mapstructure:"host"`
	Root      string `mapstructure:"root"`
	Cert      string `mapstructure:"cert"`
	Key       string `mapstructure:"key"`
	Templates string `mapstructure:"templates"`
	Docs      bool   `mapstructure:"docs"`
}

Server defines the webserver configuration.

type Token

type Token struct {
	Secret string        `mapstructure:"secret"`
	Expire time.Duration `mapstructure:"expire"`
}

Token defines the token handle configuration.

type Upload

type Upload struct {
	Driver   string `mapstructure:"driver"`
	Endpoint string `mapstructure:"endpoint"`
	Path     string `mapstructure:"path"`
	Access   string `mapstructure:"access"`
	Secret   string `mapstructure:"secret"`
	Bucket   string `mapstructure:"bucket"`
	Region   string `mapstructure:"region"`
	Perms    string `mapstructure:"perms"`
}

Upload defines the asset upload configuration.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳