config

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const ConfigFile = "rekoda.toml"

Variables

View Source
var (
	EnvConfigFile  = os.Getenv("REKODA_CONF_FILE")
	EnvConfigDir   = os.Getenv("REKODA_CONF_DIR")
	EnvStreamsDir  = os.Getenv("REKODA_STREAMS_DIR")
	FlagConfigFile = ""
	FlagConfigDir  = ""
	FlagStreamsDir = ""
	EnvLogLevel    = os.Getenv("REKODA_LOG_LEVEL") // Options: trace, debug, info (default)
	FlagLogLevel   = ""
)

Functions

func ChannelAdd

func ChannelAdd(username string)

func ChannelDelete

func ChannelDelete(username string)

func ChannelDisable

func ChannelDisable(username string)

func ChannelEnable

func ChannelEnable(username string)

func ChannelUpdateID

func ChannelUpdateID(username string, id int64)

Types

type Channels

type Channels struct {
	Enabled bool   `toml:"enabled"`
	User    string `toml:"user"`
	ID      int64  `toml:"id"`
	Quality string `toml:"quality"`
}

type Config

type Config struct {
	Title      string     `toml:"title"`
	Version    int        `toml:"version"`
	ConfigDir  string     `toml:"config_dir"`
	ConfigFile string     `toml:"config_file"`
	StreamsDir string     `toml:"streams_dir"`
	Channels   []Channels `toml:"channels"`
}
var ConfigStruct Config

func InitConfig

func InitConfig() *Config

initConfig reads in config file and ENV variables if set, otherwise initialize default conf

func (*Config) AutomaticEnv

func (c *Config) AutomaticEnv(ctxLog *log.Entry)

func (*Config) ChannelList

func (c *Config) ChannelList() (string, string)

ChannelList lists all channels in Config struct

func (*Config) ConfigFileExists

func (c *Config) ConfigFileExists(filepath string) bool

ConfigFileExists checks if config file exists in the stated filepath parameter

func (*Config) CreateDefaultConf

func (c *Config) CreateDefaultConf() error

CreateDefaultConf creates default rekoda.toml conf file and writes it to disk. Used by default when --config or REKODA_CONF_FILE environement is not specified by user and rekoda.toml file does not exists in its default path ($HOME/rekoda/rekoda.toml)

func (*Config) GetRecAmountChannels

func (c *Config) GetRecAmountChannels() int

GetRecAmountChannels returns amount of channels being enabled for record

func (*Config) IsChannelInConfig

func (c *Config) IsChannelInConfig(channel string) bool

IsChannelInConfig checks if specific channel is in Config struct

func (*Config) Load

func (c *Config) Load() error

Load reads back from rekoda.toml file and unmarshal int Config struct

func (*Config) MakeDefaultConfStruct

func (c *Config) MakeDefaultConfStruct()

MakeDefaultConfStruct initializes default conf struct

func (*Config) Save

func (c *Config) Save() error

Save writes current Config struct into rekoda.toml file

func (*Config) SetConfFile

func (c *Config) SetConfFile(ctxLog *log.Entry)

func (*Config) SetLogLevel

func (c *Config) SetLogLevel(ctxLog *log.Entry)

func (*Config) SetStreamsDir

func (c *Config) SetStreamsDir(ctxLog *log.Entry)

Jump to

Keyboard shortcuts

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