Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
// ConfigPath is "config.toml" by default
ConfigPath = "config.toml"
)
Functions ¶
Types ¶
type BBoltConfig ¶
type BBoltConfig struct { Path string `env:"BBOLT_PATH"` FileMode os.FileMode `env:"BBOLT_FILE_MODE"` ShortedURLsBucketName string `env:"BBOLT_BUCKET_SHORT_URLS"` }
BBoltConfig -> Config for BBolt implementation
type BackendConfig ¶
type BlockedHosts ¶
type BlockedHosts struct {
Hosts []string
}
BlockedHosts ...
func (*BlockedHosts) Set ¶
func (b *BlockedHosts) Set(val string) error
Set -> Set BlockedHosts.Hosts from a string
type Config ¶
type Config struct { DryRedirect bool `env:"DRY_REDIRECT"` BlockedHosts *BlockedHosts `env:"BLOCKED_HOSTS"` ExpirationCheckInterval duration `env:"EXPIRATION_CHECK_INTERVAL"` ExpirationDryRun bool `env:"EXPIRATION_DRY_RUN"` Backends *BackendConfig Database *DatabaseConfig WebServer *WebServerConfig }
Config -> Config for Database implementations
func LoadConfig ¶
func LoadConfig() *Config
LoadConfig loads a config if the config exists, otherwise creates a default config
type DatabaseConfig ¶
type DatabaseConfig struct { Mongo *MongoConfig Redis *RedisConfig BBolt *BBoltConfig Maria *MariaConfig }
DatabaseConfig -> Config for PersistentDatabase implementations
type MariaConfig ¶
type MariaConfig struct { Addr string `env:"MARIA_ADDR"` User string `env:"MARIA_USER"` Password string `env:"MARIA_PASS"` DBName string `env:"MARIA_DATABASE"` TablePrefix string `env:"MARIA_TABLE_PREFIX"` }
MariaConfig -> Config for Maria Imlementation
type MongoConfig ¶
type MongoConfig struct { ApplyURI string `env:"MDB_APPLY_URI"` Database string `env:"MDB_DATABASE"` ShortURLCollection string `env:"MDB_COLLECTION_SHORT_URLS"` MetaCollection string `env:"MDB_COLLECTION_META"` }
MongoConfig -> Config for MongoDB implementation
type RedisConfig ¶
type RedisConfig struct { Addr string `env:"REDIS_ADDR"` Password string `env:"REDIS_PASS"` DB int `env:"REDIS_DATABASE"` }
RedisConfig -> Config for Redis implementation
type WebServerConfig ¶
type WebServerConfig struct {
Addr string `env:"WEB_ADDR"`
}
WebServerConfig -> Config for web.WebServer
Click to show internal directories.
Click to hide internal directories.