@@ -13,41 +13,13 @@ import (
1313 "github.com/mxpv/podsync/pkg/db"
1414 "github.com/mxpv/podsync/pkg/feed"
1515 "github.com/mxpv/podsync/pkg/model"
16+ "github.com/mxpv/podsync/pkg/server"
1617 "github.com/mxpv/podsync/pkg/ytdl"
1718)
1819
19- type ServerConfig struct {
20- // Hostname to use for download links
21- Hostname string `toml:"hostname"`
22- // Port is a server port to listen to
23- Port int `toml:"port"`
24- // Bind a specific IP addresses for server
25- // "*": bind all IP addresses which is default option
26- // localhost or 127.0.0.1 bind a single IPv4 address
27- BindAddress string `toml:"bind_address"`
28- // Specify path for reverse proxy and only [A-Za-z0-9]
29- Path string `toml:"path"`
30- // DataDir is a path to a directory to keep XML feeds and downloaded episodes,
31- // that will be available to user via web server for download.
32- DataDir string `toml:"data_dir"`
33- }
34-
35- type Log struct {
36- // Filename to write the log to (instead of stdout)
37- Filename string `toml:"filename"`
38- // MaxSize is the maximum size of the log file in MB
39- MaxSize int `toml:"max_size"`
40- // MaxBackups is the maximum number of log file backups to keep after rotation
41- MaxBackups int `toml:"max_backups"`
42- // MaxAge is the maximum number of days to keep the logs for
43- MaxAge int `toml:"max_age"`
44- // Compress old backups
45- Compress bool `toml:"compress"`
46- }
47-
4820type Config struct {
4921 // Server is the web server configuration
50- Server ServerConfig `toml:"server"`
22+ Server server. Config `toml:"server"`
5123 // Log is the optional logging configuration
5224 Log Log `toml:"log"`
5325 // Database configuration
@@ -61,6 +33,19 @@ type Config struct {
6133 Downloader ytdl.Config `toml:"downloader"`
6234}
6335
36+ type Log struct {
37+ // Filename to write the log to (instead of stdout)
38+ Filename string `toml:"filename"`
39+ // MaxSize is the maximum size of the log file in MB
40+ MaxSize int `toml:"max_size"`
41+ // MaxBackups is the maximum number of log file backups to keep after rotation
42+ MaxBackups int `toml:"max_backups"`
43+ // MaxAge is the maximum number of days to keep the logs for
44+ MaxAge int `toml:"max_age"`
45+ // Compress old backups
46+ Compress bool `toml:"compress"`
47+ }
48+
6449// LoadConfig loads TOML configuration from a file path
6550func LoadConfig (path string ) (* Config , error ) {
6651 data , err := ioutil .ReadFile (path )
0 commit comments