config

package
v0.0.0-...-27b812d Latest Latest
Warning

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

Go to latest
Published: May 29, 2016 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

package for parsing config files

Index

Constants

This section is empty.

Variables

View Source
var DefaultConfig = Config{
	Store: &StoreConfig{
		Path: "storage",
	},
	NNTP: &NNTPServerConfig{

		Bind: "127.0.0.1:1119",
		Name: "nntp.server.tld",
		Article: &ArticleConfig{
			AllowGroups:          []string{"ctl", "overchan.test"},
			DisallowGroups:       []string{"overchan.cp"},
			ForceWhitelist:       false,
			AllowAnon:            true,
			AllowAttachments:     true,
			AllowAnonAttachments: false,
		},
	},
}

default configuration

Functions

This section is empty.

Types

type ArticleConfig

type ArticleConfig struct {
	// explicitly allow these newsgroups
	AllowGroups []string
	// explicitly disallow these newsgroups
	DisallowGroups []string
	// only allow explicitly allowed groups
	ForceWhitelist bool
	// allow anonymous posts?
	AllowAnon bool
	// allow attachments?
	AllowAttachments bool
	// allow anonymous attachments?
	AllowAnonAttachments bool
}

configration for local article policies

type Config

type Config struct {

	// list of feeds to add on runtime
	Feeds []*FeedConfig `json:"feeds"`
	// nntp server configuration
	NNTP *NNTPServerConfig `json:"nntp"`
	// log level
	Log string `json:"log"`

	Store *StoreConfig `json:"storage"`
	// contains filtered or unexported fields
}

main configuration

func Ensure

func Ensure(fname string) (cfg *Config, err error)

ensure that a config file exists creates one if it does not exist

func Load

func Load(fname string) (cfg *Config, err error)

load configuration file

func (*Config) Reload

func (c *Config) Reload() (err error)

reload configuration

type FeedConfig

type FeedConfig struct {
	// feed's policy, filters articles
	Policy *ArticleConfig `json:"policy"`
	// remote server's address
	Addr string `json:"addr"`
	// do we want to periodically pull from this server?
	PullSync bool `json:"pull_enabled"`
	// proxy server config
	Proxy *ProxyConfig `json:"proxy"`
	// nntp username to log in with
	Username string `json:"-"`
	// nntp password to use when logging in
	Password string `json:"-"`
	// do we want to use tls?
	TLS bool `json:"tls"`
	// the name of this feed
	Name string `json:"name"`
	// how often to pull articles from the server
	PullInterval time.Duration `json:"pull_interval"`
}

configuration for 1 nntp feed

type NNTPServerConfig

type NNTPServerConfig struct {
	// address to bind to
	Bind string
	// name of the nntp server
	Name string
	// default inbound article policy
	Article *ArticleConfig
}

type ProxyConfig

type ProxyConfig struct {
	ProxyType string
	ProxyAddr string
}

type StoreConfig

type StoreConfig struct {
	// path to article directory
	Path string `json:"path"`
}

Jump to

Keyboard shortcuts

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