diff options
Diffstat (limited to 'pkg/app/config.go')
| -rw-r--r-- | pkg/app/config.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/pkg/app/config.go b/pkg/app/config.go index 12cf21d..f8ca2e8 100644 --- a/pkg/app/config.go +++ b/pkg/app/config.go @@ -5,17 +5,20 @@ import ( "os" ) +// Config settings for main App. type Config struct { LibraryPath string `json:"library"` Server *ServerConfig `json:"server"` Feed *FeedConfig `json:"feed"` } +// ServerConfig settings for App Server. type ServerConfig struct { Host string `json:"host"` Port int `json:"port"` } +// FeedConfig settings for App Feed. type FeedConfig struct { ExternalURL string `json:"external_url"` Title string `json:"title"` @@ -28,6 +31,7 @@ type FeedConfig struct { Copyright string `json:"copyright"` } +// DefaultConfig returns Config initialized with default values. func DefaultConfig() *Config { return &Config{ LibraryPath: "videos", @@ -41,6 +45,7 @@ func DefaultConfig() *Config { } } +// ReadFile reads a JSON file into Config. func (c *Config) ReadFile(path string) error { f, err := os.Open(path) if err != nil { |
