summaryrefslogtreecommitdiff
path: root/pkg/app/config.go
diff options
context:
space:
mode:
authordavy <davy.wybiral@gmail.com>2019-06-29 17:02:05 -0500
committerdavy <davy.wybiral@gmail.com>2019-06-29 17:02:05 -0500
commita7a5eee66ff685e4094540e84c9c4994d30811ab (patch)
treede25a317968d2dc885f6f53d8b2b00eeaa060f0f /pkg/app/config.go
parent0979457d751b79cee627fb9f78ce1b0280ef969e (diff)
docs
Diffstat (limited to 'pkg/app/config.go')
-rw-r--r--pkg/app/config.go5
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 {