config

package
v0.0.0-...-eb23ef5 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2022 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Defaults = Values{
	ConfigPath: "",
	LogLevel:   "info",

	ActorKeySize:       2048,
	ApplicationName:    "feditools-caprisage",
	ApplicationWebsite: "https://github.com/feditools/caprisage",
	ExternalHostname:   "localhost",
	HTTPBind:           ":5000",

	DbAddress:   "",
	DbPort:      5432,
	DbUser:      "",
	DbPassword:  "",
	DbDatabase:  "relay",
	DbTLSMode:   "disable",
	DbTLSCACert: "",

	FileStoreBucket:   "caprisage",
	FileStoreEndpoint: "play.min.io",
	FileStoreRegion:   "us-east-1",
	FileStoreUseTLS:   true,

	RedisAddress: "localhost:6379",
	RedisDB:      0,

	WebappMinifyHTML: true,

	WebappAutocompleteCSSURI:         "https://assets.fedi.tools/vendor/autocomplete.js-2.7.0/autocomplete.min.css",
	WebappAutocompleteCSSIntegrity:   "sha384-u12ZGJV65JuZRbgvaEgy5RlZ2bpR54+rsNw2jfygzX5LpGsuiM9KJRZHkgATW0Q3",
	WebappAutocompleteJSURI:          "https://assets.fedi.tools/vendor/autocomplete.js-2.7.0/autocomplete.min.js",
	WebappAutocompleteJSIntegrity:    "sha384-QvI5i89veGwBs648CB2bctuHb7RAjx/M0i3i6UCZ91Y/YhbO5Ka/3D6EwxV3j8bP",
	WebappBootstrapCSSURI:            "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css",
	WebappBootstrapCSSIntegrity:      "sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor",
	WebappBootstrapJSURI:             "https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js",
	WebappBootstrapJSIntegrity:       "sha384-pprn3073KE6tl6bjs2QrFaJGz5/SUsLqktiwsUTF55Jfv3qYSDhgCecCxMW52nD2",
	WebappBootstrapIconsCSSURI:       "https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css",
	WebappBootstrapIconsCSSIntegrity: "sha384-xeJqLiuOvjUBq3iGOjvSQSIlwrpqjSHXpduPd6rQpuiM3f5/ijby8pCsnbu5S81n",
	WebappChartJSURI:                 "https://cdn.jsdelivr.net/npm/[email protected]/dist/chart.min.js",
	WebappChartJSIntegrity:           "sha384-9MhbyIRcBVQiiC7FSd7T38oJNj2Zh+EfxS7/vjhBi4OOT78NlHSnzM31EZRWR1LZ",
	WebappLogoSrcDark:                "https://assets.fedi.tools/img/feditools-logo-dark.svg",
	WebappLogoSrcLight:               "https://assets.fedi.tools/img/feditools-logo-light.svg",
}

Defaults contains the default values

View Source
var Keys = KeyNames{
	ConfigPath: "config-path",
	LogLevel:   "log-level",

	ActorKeySize:       "actor-key-size",
	ApplicationName:    "application-name",
	ApplicationWebsite: "application-website",
	EncryptionKey:      "encryption-key",
	ExternalHostname:   "external-hostname",
	HTTPBind:           "http-bind",
	SoftwareVersion:    "software-version",
	TokenSalt:          "token-salt",

	DbAddress:   "db-address",
	DbPort:      "db-port",
	DbUser:      "db-user",
	DbPassword:  "db-password",
	DbDatabase:  "db-database",
	DbTLSMode:   "db-tls-mode",
	DbTLSCACert: "db-tls-ca-cert",

	FileStoreBucket:          "filestore-bucket",
	FileStoreEndpoint:        "filestore-endpoint",
	FileStoreRegion:          "filestore-region",
	FileStoreAccessKeyID:     "filestore-access-key-id",
	FileStoreSecretAccessKey: "filestore-secret-access-key",
	FileStoreUseTLS:          "filestore-use-tls",

	RedisAddress:  "redis-address",
	RedisDB:       "redis-db",
	RedisPassword: "redis-password",

	WebappMinifyHTML: "minify-html",

	WebappAutocompleteCSSURI:         "webapp-autocomplete-css-uri",
	WebappAutocompleteCSSIntegrity:   "webapp-autocomplete-css-integrity",
	WebappAutocompleteJSURI:          "webapp-autocomplete-js-uri",
	WebappAutocompleteJSIntegrity:    "webapp-autocomplete-js-integrity",
	WebappBootstrapCSSURI:            "webapp-bootstrap-css-uri",
	WebappBootstrapCSSIntegrity:      "webapp-bootstrap-css-integrity",
	WebappBootstrapJSURI:             "webapp-bootstrap-js-uri",
	WebappBootstrapJSIntegrity:       "webapp-bootstrap-js-integrity",
	WebappBootstrapIconsCSSURI:       "webapp-bootstrap-icons-css-uri",
	WebappBootstrapIconsCSSIntegrity: "webapp-bootstrap-icons-css-integrity",
	WebappChartJSURI:                 "webapp-chart-js-uri",
	WebappChartJSIntegrity:           "webapp-chart-js-integrity",
	WebappLogoSrcDark:                "webapp-logo-src-dark",
	WebappLogoSrcLight:               "webapp-logo-src-light",

	Account:         "account",
	AccountAddGroup: "add-group",
}

Keys contains the names of config keys.

Functions

func Init

func Init(flags *pflag.FlagSet) error

Init starts config collection

func ReadConfigFile

func ReadConfigFile() error

ReadConfigFile reads the config file from disk if config path is sent.

Types

type KeyNames

type KeyNames struct {
	LogLevel   string
	ConfigPath string

	// application
	ActorKeySize       string
	ApplicationName    string
	ApplicationWebsite string
	EncryptionKey      string
	ExternalHostname   string
	HTTPBind           string
	SoftwareVersion    string
	TokenSalt          string

	// database
	DbAddress   string
	DbPort      string
	DbUser      string
	DbPassword  string
	DbDatabase  string
	DbTLSMode   string
	DbTLSCACert string

	// filestore
	FileStoreBucket          string
	FileStoreEndpoint        string
	FileStoreRegion          string
	FileStoreAccessKeyID     string
	FileStoreSecretAccessKey string
	FileStoreUseTLS          string

	// redis
	RedisAddress  string
	RedisDB       string
	RedisPassword string

	// webapp
	WebappMinifyHTML string

	WebappAutocompleteCSSURI         string
	WebappAutocompleteCSSIntegrity   string
	WebappAutocompleteJSURI          string
	WebappAutocompleteJSIntegrity    string
	WebappBootstrapCSSURI            string
	WebappBootstrapCSSIntegrity      string
	WebappBootstrapJSURI             string
	WebappBootstrapJSIntegrity       string
	WebappBootstrapIconsCSSURI       string
	WebappBootstrapIconsCSSIntegrity string
	WebappChartJSURI                 string
	WebappChartJSIntegrity           string
	WebappLogoSrcDark                string
	WebappLogoSrcLight               string

	// account
	Account         string
	AccountAddGroup string
}

KeyNames is a struct that contains the names of keys.

type Values

type Values struct {
	ConfigPath string
	LogLevel   string

	// application
	ActorKeySize       int
	ApplicationName    string
	ApplicationWebsite string
	EncryptionKey      string
	ExternalHostname   string
	HTTPBind           string
	SoftwareVersion    string
	TokenSalt          string

	// database
	DbAddress   string
	DbPort      int
	DbUser      string
	DbPassword  string
	DbDatabase  string
	DbTLSMode   string
	DbTLSCACert string

	// filestore
	FileStoreBucket          string
	FileStoreEndpoint        string
	FileStoreRegion          string
	FileStoreAccessKeyID     string
	FileStoreSecretAccessKey string
	FileStoreUseTLS          bool

	// redis
	RedisAddress  string
	RedisDB       int
	RedisPassword string

	// webapp
	WebappMinifyHTML bool

	WebappAutocompleteCSSURI         string
	WebappAutocompleteCSSIntegrity   string
	WebappAutocompleteJSURI          string
	WebappAutocompleteJSIntegrity    string
	WebappBootstrapCSSURI            string
	WebappBootstrapCSSIntegrity      string
	WebappBootstrapJSURI             string
	WebappBootstrapJSIntegrity       string
	WebappBootstrapIconsCSSURI       string
	WebappBootstrapIconsCSSIntegrity string
	WebappChartJSURI                 string
	WebappChartJSIntegrity           string
	WebappLogoSrcDark                string
	WebappLogoSrcLight               string

	// account
	Account         string
	AccountAddGroup []string
}

Values contains the type of each value.

Jump to

Keyboard shortcuts

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