Documentation ¶
Index ¶
Constants ¶
View Source
const ( FileStoreTypeLocal = "local" FileStoreTypeMinio = "minio" // ServerRoleWebapp represents the webapp server role. ServerRoleWebapp = "webapp" )
Variables ¶
View Source
var Defaults = Values{ ConfigPath: "", LogLevel: "info", ApplicationName: "feditools-democrablock", ApplicationWebsite: "https://github.com/feditools/democrablock", DBType: "postgres", DBAddress: "localhost", DBPort: 5432, DBUser: "democrablock", DBDatabase: "democrablock", DBTLSMode: "disable", DBTLSCACert: "", DBLoadTestData: false, FileStoreType: FileStoreTypeLocal, FileStorePath: "filestore", FileStoreBucket: "democrablock", FileStoreEndpoint: "play.min.io", FileStoreRegion: "us-east-1", FileStoreUseTLS: true, FileStorePresignedURLExpiration: 5 * time.Minute, RedisAddress: "localhost:6379", RedisDB: 0, RedisPassword: "", ServerExternalURL: "http://localhost:5000", ServerHTTPBind: ":5000", ServerMinifyHTML: true, ServerRoles: []string{ ServerRoleWebapp, }, WebappBootstrapCSSURI: "https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css", WebappBootstrapCSSIntegrity: "sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3", WebappBootstrapJSURI: "https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js", WebappBootstrapJSIntegrity: "sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p", WebappFontAwesomeCSSURI: "https://cdn.fedi.tools/vendor/fontawesome-free-6.1.1/css/all.min.css", WebappFontAwesomeCSSIntegrity: "sha384-/frq1SRXYH/bSyou/HUp/hib7RVN1TawQYja658FEOodR/FQBKVqT9Ol+Oz3Olq5", WebappLogoSrcDark: "https://cdn.fedi.tools/img/feditools-logo-dark.svg", WebappLogoSrcLight: "https://cdn.fedi.tools/img/feditools-logo-light.svg", MetricsStatsDAddress: "localhost:8125", MetricsStatsDPrefix: "democrablock", }
Defaults contains the default values.
View Source
var Keys = KeyNames{
ConfigPath: "config-path",
LogLevel: "log-level",
ApplicationName: "application-name",
ApplicationWebsite: "application-website",
SoftwareVersion: "software-version",
TokenSalt: "token-salt",
EncryptionKey: "encryption-key",
DBType: "db-type",
DBAddress: "db-address",
DBPort: "db-port",
DBUser: "db-user",
DBPassword: "db-password",
DBDatabase: "db-database",
DBTLSMode: "db-tls-mode",
DBTLSCACert: "db-tls-ca-cert",
DBLoadTestData: "test-data",
FileStoreType: "filestore-type",
FileStorePath: "filestore-path",
FileStoreBucket: "filestore-bucket",
FileStoreEndpoint: "filestore-endpoint",
FileStoreRegion: "filestore-region",
FileStoreAccessKeyID: "filestore-access-key-id",
FileStoreSecretAccessKey: "filestore-secret-access-key",
FileStoreUseTLS: "filestore-use-tls",
FileStorePresignedURLExpiration: "filestore-presigned-utl-expiration",
RedisAddress: "redis-address",
RedisDB: "redis-db",
RedisPassword: "redis-password",
Account: "account",
AccountAddGroup: "add-group",
CouncilMembers: "member",
ServerExternalURL: "external-url",
ServerHTTPBind: "http-bind",
ServerMinifyHTML: "minify-html",
ServerRoles: "server-role",
WebappBootstrapCSSURI: "webapp-bootstrap-css-uri",
WebappBootstrapCSSIntegrity: "webapp-bootstrap-css-integrity",
WebappBootstrapJSURI: "webapp-bootstrap-js-uri",
WebappBootstrapJSIntegrity: "webapp-bootstrap-js-integrity",
WebappFontAwesomeCSSURI: "webapp-fontawesome-css-uri",
WebappFontAwesomeCSSIntegrity: "webapp-fontawesome-css-integrity",
WebappLogoSrcDark: "webapp-logo-src-dark",
WebappLogoSrcLight: "webapp-logo-src-light",
MetricsStatsDAddress: "statsd-addr",
MetricsStatsDPrefix: "statsd-prefix",
}
Keys contains the names of config keys.
Functions ¶
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 ApplicationName string ApplicationWebsite string EncryptionKey string SoftwareVersion string TokenSalt string // database DBType string DBAddress string DBPort string DBUser string DBPassword string DBDatabase string DBTLSMode string DBTLSCACert string DBLoadTestData string // filestore FileStoreType string FileStorePath string FileStoreBucket string FileStoreEndpoint string FileStoreRegion string FileStoreAccessKeyID string FileStoreSecretAccessKey string FileStoreUseTLS string FileStorePresignedURLExpiration string // redis RedisAddress string RedisDB string RedisPassword string // account Account string AccountAddGroup string // council CouncilMembers string // server ServerExternalURL string ServerHTTPBind string ServerMinifyHTML string ServerRoles string // webapp WebappBootstrapCSSURI string WebappBootstrapCSSIntegrity string WebappBootstrapJSURI string WebappBootstrapJSIntegrity string WebappFontAwesomeCSSURI string WebappFontAwesomeCSSIntegrity string WebappLogoSrcDark string WebappLogoSrcLight string // metrics MetricsStatsDAddress string MetricsStatsDPrefix string }
KeyNames is a struct that contains the names of keys.
type Values ¶
type Values struct { ConfigPath string LogLevel string // application ApplicationName string ApplicationWebsite string EncryptionKey string SoftwareVersion string TokenSalt string // database DBType string DBAddress string DBPort int DBUser string DBPassword string DBDatabase string DBTLSMode string DBTLSCACert string DBLoadTestData bool // filestore FileStoreType string FileStorePath string FileStoreBucket string FileStoreEndpoint string FileStoreRegion string FileStoreAccessKeyID string FileStoreSecretAccessKey string FileStoreUseTLS bool FileStorePresignedURLExpiration time.Duration // redis RedisAddress string RedisDB int RedisPassword string // account Account string AccountAddGroup []string // council CouncilMembers []string // server ServerExternalURL string ServerHTTPBind string ServerMinifyHTML bool ServerRoles []string // webapp WebappBootstrapCSSURI string WebappBootstrapCSSIntegrity string WebappBootstrapJSURI string WebappBootstrapJSIntegrity string WebappFontAwesomeCSSURI string WebappFontAwesomeCSSIntegrity string WebappLogoSrcDark string WebappLogoSrcLight string // metrics MetricsStatsDAddress string MetricsStatsDPrefix string }
Values contains the type of each value.
Click to show internal directories.
Click to hide internal directories.