2022-11-29 20:38:39 +00:00
|
|
|
package config
|
2022-11-19 18:19:42 +00:00
|
|
|
|
|
|
|
// Config of the program.
|
|
|
|
type Config struct {
|
|
|
|
Logging
|
2022-11-19 18:34:11 +00:00
|
|
|
Server
|
2022-11-19 18:19:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Logging configuration.
|
|
|
|
type Logging struct {
|
|
|
|
|
|
|
|
// AccessLog path.
|
|
|
|
AccessLog string
|
|
|
|
|
2022-11-20 16:53:51 +00:00
|
|
|
// ErrorsLog path.
|
|
|
|
ErrorsLog string
|
|
|
|
|
2022-11-19 18:19:42 +00:00
|
|
|
// Interval between access log flushes, in seconds.
|
|
|
|
Interval int
|
|
|
|
}
|
|
|
|
|
2022-11-19 18:34:11 +00:00
|
|
|
// Server configuration.
|
|
|
|
type Server struct {
|
|
|
|
|
|
|
|
// PortHTTP is port where HTTP server must listen.
|
|
|
|
// If 0, HTTP is disabled.
|
|
|
|
PortHTTP int
|
|
|
|
|
|
|
|
// PortHTTP is port where the HTTPS server must listen.
|
|
|
|
// If 0, HTTPS is disabled.
|
|
|
|
PortHTTPS int
|
2022-11-20 09:03:31 +00:00
|
|
|
|
|
|
|
// TLSCertFile contains path to cert file for TLS Server.
|
|
|
|
TLSCertFile string
|
|
|
|
|
|
|
|
// TLSCertFile contains path to key file for TLS Server.
|
|
|
|
TLSKeyFile string
|
2022-11-19 18:34:11 +00:00
|
|
|
}
|
|
|
|
|
2022-11-19 18:19:42 +00:00
|
|
|
// Conf contains the current configuration.
|
|
|
|
var Conf = Config{
|
|
|
|
Logging{
|
|
|
|
AccessLog: "/wttr.in/log/access.log",
|
2022-11-20 16:53:51 +00:00
|
|
|
ErrorsLog: "/wttr.in/log/errors.log",
|
2022-11-19 18:19:42 +00:00
|
|
|
Interval: 300,
|
|
|
|
},
|
2022-11-19 18:34:11 +00:00
|
|
|
Server{
|
2022-11-20 09:03:31 +00:00
|
|
|
PortHTTP: 8083,
|
|
|
|
PortHTTPS: 8084,
|
|
|
|
TLSCertFile: "/wttr.in/etc/fullchain.pem",
|
|
|
|
TLSKeyFile: "/wttr.in/etc/privkey.pem",
|
2022-11-19 18:34:11 +00:00
|
|
|
},
|
2022-11-19 18:19:42 +00:00
|
|
|
}
|