config

package
Version: v0.0.0-...-b178995 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultListen  = ":8051"
	LetsEncryptDir = "letsencrypt"
)

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	Name              string `yaml:"name"`
	Path              string `yaml:"path"` // App path, optional?
	Entrypoint        string `yaml:"entrypoint"`
	Domain            string `yaml:"domain"`
	Username          string `yaml:"username"`
	Password          string `yaml:"password"`
	IndieAuthEndpoint string `yaml:"indieauth_endpoint"`
	Proxy             string `yaml:"proxy"`
	Remote            string `yaml:"remote"`
	Scheduled         string `yaml:"scheduled"`

	Config map[string]interface{} `yaml:"config"`
}

AppConfig holds an app configuration items

type BasicAuth

type BasicAuth struct {
	ID       string   `yaml:"id"`
	Roles    []string `yaml:"roles"`
	Username string   `yaml:"username"`
	Password string   `yaml:"password"`
}

type Config

type Config struct {
	Listen   string `yaml:"listen"`
	LogLevel string `yaml:"log_level"`
	// TLS     bool     `yaml:"tls"`
	AutoTLS bool     `yaml:"tls_auto"`
	Domains []string `yaml:"tls_domains"`

	Roles []*Role `yaml:"roles"`
	Auth  []*BasicAuth

	ExpvarListen string `yaml:"expvar_server_listen"`

	ExtraApacheCombinedLogs string `yaml:"extra_apache_combined_logs"`

	SharingKey string  `yaml:"sharing_key"`
	DataDir    string  `yaml:"data_dir"`
	S3Repl     *S3Repl `yaml:"s3_replication"`

	Apps          []*AppConfig    `yaml:"apps"`
	Docstore      *DocstoreConfig `yaml:"docstore"`
	Replication   *Replication    `yaml:"replication"`
	ReplicateFrom *ReplicateFrom  `yaml:"replicate_from"`

	SecretKey string `yaml:"secret_key"`

	// Items defined with the CLI flags
	CheckMode                  bool `yaml:"-"`
	ScanMode                   bool `yaml:"-"`
	S3ScanMode                 bool `yaml:"-"`
	S3RestoreMode              bool `yaml:"-"`
	DocstoreIndexesReindexMode bool `yaml:"-"`
	// contains filtered or unexported fields
}

Config holds the configuration items

func New

func New(path string) (*Config, error)

New initialize a config object by loading the YAML path at the given path

func (*Config) ConfigDir

func (c *Config) ConfigDir() string

VarDir returns the directory where the index will be stored

func (*Config) Init

func (c *Config) Init() error

Init initialize the config.

It will try to create all the needed directory.

func (*Config) LogLvl

func (c *Config) LogLvl() log15.Lvl

func (*Config) StashDir

func (c *Config) StashDir() string

VarDir returns the directory where the index will be stored

func (*Config) VarDir

func (c *Config) VarDir() string

VarDir returns the directory where the index will be stored

func (*Config) VidDir

func (c *Config) VidDir() string

VarDir returns the directory where the video metadata and transcoded webm

type DocstoreConfig

type DocstoreConfig struct {
	SortIndexes map[string]map[string]*DocstoreSortIndex `yaml:"sort_indexes"`
}

type DocstoreSortIndex

type DocstoreSortIndex struct {
	Field string `yaml:"field"`
}

type Perm

type Perm struct {
	Action   string `yaml:"action"`
	Resource string `yaml:"resource"`
}

type ReplicateFrom

type ReplicateFrom struct {
	URL    string `yaml:"url"`
	APIKey string `yaml:"api_key"`
}

type Replication

type Replication struct {
	EnableOplog bool `yaml:"enable_oplog"`
}

type Role

type Role struct {
	Name     string                 `yaml:"name"`
	Template string                 `yaml:"template"`
	Perms    []*Perm                `yaml:"permissions"`
	Args     map[string]interface{} `yaml:"args"`

	// Only set pragmatically for "managed role"
	Managed      bool     `yaml:"-"`
	ArgsRequired []string `yaml:"-"`
}

type S3Repl

type S3Repl struct {
	Bucket    string `yaml:"bucket"`
	Region    string `yaml:"region"`
	KeyFile   string `yaml:"key_file"`
	Endpoint  string `yaml:"endpoint"`
	AccessKey string `yaml:"access_key_id"`
	SecretKey string `yaml:"secret_access_key"`
}

func (*S3Repl) Key

func (s3 *S3Repl) Key() (*[32]byte, error)

Source Files

Directories

Path Synopsis
Package pathutil implements helpers to retrieve config/cache/var directories.
Package pathutil implements helpers to retrieve config/cache/var directories.

Jump to

Keyboard shortcuts

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