app

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 8, 2019 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package app manages main application server.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Config    *Config
	Library   *media.Library
	Watcher   *fsnotify.Watcher
	Templates *template.Template
	Feed      []byte
	Tor       *tor
	Listener  net.Listener
	Router    *mux.Router
}

App represents main application.

func NewApp

func NewApp(cfg *Config) (*App, error)

NewApp returns a new instance of App from Config.

func (*App) Run

func (a *App) Run() error

Run imports the library and starts server.

type Config

type Config struct {
	Library []*PathConfig `json:"library"`
	Server  *ServerConfig `json:"server"`
	Feed    *FeedConfig   `json:"feed"`
	Tor     *TorConfig    `json:"tor,omitempty"`
}

Config settings for main App.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns Config initialized with default values.

func (*Config) ReadFile

func (c *Config) ReadFile(path string) error

ReadFile reads a JSON file into Config.

type FeedConfig

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"`
}

FeedConfig settings for App Feed.

type PathConfig added in v0.1.0

type PathConfig struct {
	Path   string `json:"path"`
	Prefix string `json:"prefix"`
}

PathConfig settings for media library path.

type ServerConfig

type ServerConfig struct {
	Host string `json:"host"`
	Port int    `json:"port"`
}

ServerConfig settings for App Server.

type TorConfig added in v0.1.0

type TorConfig struct {
	Enable     bool                 `json:"enable"`
	Controller *TorControllerConfig `json:"controller"`
}

TorConfig stores tor configuration.

type TorControllerConfig added in v0.1.0

type TorControllerConfig struct {
	Host     string `json:"host"`
	Port     int    `json:"port"`
	Password string `json:"password,omitempty"`
}

TorControllerConfig stores tor controller configuration.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL