Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigureLogger ¶
func ConfigureLogger(c Logger)
func SetFormatter ¶
func SetFormatter(format string)
func SetLogLevel ¶
func SetLogLevel(lvl string)
SetLogLevel sets the logging level when possible, otherwise it fallbacks to the default logrus level and logs a warning
Types ¶
type Conf ¶
type Conf struct {
Database Database `yaml:"database"`
Server Server `yaml:"server"`
Logger Logger `yaml:"logger"`
Prometheus Prometheus `yaml:"prometheus"`
Crontab Crontab `yaml:"crontab"`
}
Conf holds the necessary configuration for the application to work
var C Conf
C is the main exported configuration
type Cors ¶
type Cors struct {
AllowOrigins []string `yaml:"allow_origins"`
Enabled bool `yaml:"enabled" env:"CORS_ENABLED"`
PermissiveMode bool `yaml:"permissive_mode" env:"CORS_PERMISSIVE"`
}
Cors is a simple structure holding the information about CORS configuration
type Crontab ¶
type Crontab struct {
DownloadPath string `yaml:"download_path" env:"DOWNLOAD_PATH" default:"downloads"`
EveryXHours uint64 `yaml:"every_x_hours" env:"EVERY_X_HOURS" default:"3"`
}
Crontab is a simple struct holding configuration variables for the periodic task to be executed
type Database ¶
type Database struct {
User string `yaml:"user" env:"DB_USER"`
Name string `yaml:"name" env:"DB_NAME" default:"opensirene"`
Password string `yaml:"password" env:"DB_PASSWORD"`
Host string `yaml:"host" env:"DB_HOST" default:"127.0.0.1"`
Port int `yaml:"port" env:"DB_PORT" default:"5432"`
SSLMode string `yaml:"sslmode" env:"DB_SSL_MODE" default:"disable"`
}
Database is the structure that holds all the mandatory information about the database connection
func (Database) ConnectionString ¶
ConnectionString generates and returns the connection string used by the standard SQL library or an ORM like Gorm.
type Prometheus ¶
type Prometheus struct {
Prefix string `yaml:"prefix" env:"PROMETHEUS_PREFIX" default:"opensirene"`
}
Prometheus is a simple struct holding configuration variables for prometheus
type Server ¶
type Server struct {
Host string `yaml:"host" env:"SERVER_HOST" default:"127.0.0.1"`
Port int `yaml:"port" env:"SERVER_PORT" default:"8080"`
Debug bool `yaml:"debug" env:"SERVER_DEBUG"`
Cors Cors `yaml:"cors"`
Prefix Prefix `yaml:"prefix"`
}
Server is the structure that holds the server configuration