summaryrefslogtreecommitdiff
path: root/pkg/app/config.go
diff options
context:
space:
mode:
authorJames Mills <prologic@shortcircuit.net.au>2020-03-21 09:55:06 +1000
committerJames Mills <prologic@shortcircuit.net.au>2020-03-21 09:55:06 +1000
commit4dae45a68ff1ff32a251a5835b2a2723ae125d1c (patch)
treeb3abe641f39f50ac444aee2bb617d7b4ab44187d /pkg/app/config.go
parent76fa613b7eaf1c8626d2a51901c623af7bf1a665 (diff)
Restructured source code layout, Added rice support for templates and static assets
Diffstat (limited to 'pkg/app/config.go')
-rw-r--r--pkg/app/config.go89
1 files changed, 0 insertions, 89 deletions
diff --git a/pkg/app/config.go b/pkg/app/config.go
deleted file mode 100644
index ec27435..0000000
--- a/pkg/app/config.go
+++ /dev/null
@@ -1,89 +0,0 @@
-package app
-
-import (
- "encoding/json"
- "os"
-)
-
-// Config settings for main App.
-type Config struct {
- Library []*PathConfig `json:"library"`
- Server *ServerConfig `json:"server"`
- Feed *FeedConfig `json:"feed"`
- Tor *TorConfig `json:"tor,omitempty"`
-}
-
-// PathConfig settings for media library path.
-type PathConfig struct {
- Path string `json:"path"`
- Prefix string `json:"prefix"`
-}
-
-// 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"`
- Link string `json:"link"`
- Description string `json:"description"`
- Author struct {
- Name string `json:"name"`
- Email string `json:"email"`
- } `json:"author"`
- Copyright string `json:"copyright"`
-}
-
-// TorConfig stores tor configuration.
-type TorConfig struct {
- Enable bool `json:"enable"`
- Controller *TorControllerConfig `json:"controller"`
-}
-
-// TorControllerConfig stores tor controller configuration.
-type TorControllerConfig struct {
- Host string `json:"host"`
- Port int `json:"port"`
- Password string `json:"password,omitempty"`
-}
-
-// DefaultConfig returns Config initialized with default values.
-func DefaultConfig() *Config {
- return &Config{
- Library: []*PathConfig{
- &PathConfig{
- Path: "videos",
- Prefix: "",
- },
- },
- Server: &ServerConfig{
- Host: "127.0.0.1",
- Port: 0,
- },
- Feed: &FeedConfig{
- ExternalURL: "http://localhost",
- },
- Tor: &TorConfig{
- Enable: false,
- Controller: &TorControllerConfig{
- Host: "127.0.0.1",
- Port: 9051,
- },
- },
- }
-}
-
-// ReadFile reads a JSON file into Config.
-func (c *Config) ReadFile(path string) error {
- f, err := os.Open(path)
- if err != nil {
- return err
- }
- defer f.Close()
- d := json.NewDecoder(f)
- return d.Decode(c)
-}