config

package
v0.0.7-alpha Latest Latest
Warning

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

Go to latest
Published: May 30, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	WD               = "."
	DEVELOPMENT      = false
	APP_VERSION      = "0.0.1"
	STORAGES         = &fs.StorageConfig{}
	APP_ENV          = ""
	APP_KEY          = ""
	APP_TOKEN_KEY    = "token"
	APP_PORT         = "3000"
	APP_THEME        = "default"
	DB_DSN           = ""
	DB_QUERY_LOGGING = false
	ROOT_DIR         = ""
	PUBLIC_DIR       = "public"
	PRIVATE_DIR      = "private"
	COOKIE_UUID      = "uuid"
	SHOW_TETUA_BLOCK = false
)

Functions

func ConfigError

func ConfigError(name string)

func CreateConfigFile

func CreateConfigFile(workingDir string) (err error)

func Init

func Init(workingDir string)

func Setting

func Setting(key string, defaultValues ...string) string

func Settings

func Settings(values []*SettingItem, overrideValues ...[]*SettingItem)

Types

type AuthConfig

type AuthConfig struct {
	EnabledProviders []string                     `json:"enabled_providers"`
	Providers        map[string]map[string]string `json:"providers"`
}
var Auth *AuthConfig

type ConfigFile

type ConfigFile struct {
	APP_ENV          string            `json:"app_env"`
	APP_KEY          string            `json:"app_key"`
	APP_TOKEN_KEY    string            `json:"app_token_key,omitempty"`
	APP_PORT         string            `json:"app_port"`
	APP_THEME        string            `json:"app_theme,omitempty"`
	DB_DSN           string            `json:"db_dsn"`
	COOKIE_UUID      string            `json:"cookie_uuid,omitempty"`
	SHOW_TETUA_BLOCK bool              `json:"show_tetua_block,omitempty"`
	DB_QUERY_LOGGING bool              `json:"db_query_logging"`
	STORAGES         *fs.StorageConfig `json:"storage,omitempty"`
	Mail             *MailConfig       `json:"mail,omitempty"`
	Auth             *AuthConfig       `json:"auth,omitempty"`
}

type MailConfig

type MailConfig struct {
	Sender string      `json:"sender"`
	Smtp   *SmtpConfig `json:"smtp"`
}
var Mail *MailConfig

type SettingItem

type SettingItem struct {
	Name  string `json:"name" form:"name"`
	Value string `json:"value" form:"value"`
	Type  string `json:"type" form:"type"`
}

func AllSettings

func AllSettings() []*SettingItem

type SettingsMutation

type SettingsMutation struct {
	Settings []*SettingItem `json:"settings,omitempty" form:"settings"`
}

type SmtpConfig

type SmtpConfig struct {
	Secure bool   `json:"secure"`
	Host   string `json:"host"`
	Port   int    `json:"port"`
	User   string `json:"user"`
	Pass   string `json:"pass"`
}

Jump to

Keyboard shortcuts

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