conf

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(fp string) error

Load loads the configuration file into C

func SetFormatter

func SetFormatter(format string)

SetFormatter defines the way logs are formatted

func SetLogLevel

func SetLogLevel(lvl string)

SetLogLevel sets the logging level when possible, otherwise it fallbacks to the default logrus level and logs a warning

Types

type CI

type CI struct {
	Type string `yaml:"type"`
	Host string `yaml:"host"`
}

CI is a configuration struct to access a CI

type Conf

type Conf struct {
	Server           Server `yaml:"server"`
	Logger           Logger `yaml:"logger"`
	GithubOAuthToken string `yaml:"github_oauth_token"`
	RServiceInterval string `yaml:"service_interval" default:"10m"`
	RRepoInterval    string `yaml:"repo_interval" default:"10m"`

	ServiceInterval time.Duration
	RepoInterval    time.Duration
	Services        []Service `yaml:"services"`
}

Conf is a configuration struct intended to be filled from a yaml file and/or sane defaults

var C Conf

C is the main exported conf

func (*Conf) Parse

func (c *Conf) Parse() error

Parse parses the tags and configures the logger associated

type Logger

type Logger struct {
	Level  string `yaml:"level" default:"info"`
	Format string `yaml:"format" default:"text"`
}

Logger is a configuration struct to define logger's behaviour

func (Logger) Configure

func (c Logger) Configure()

Configure takes the configuration for the logger and translats it to logrus's usage

type Repo

type Repo struct {
	Type  string `yaml:"type"`
	Host  string `yaml:"host"`
	Token string `yaml:"token"`
	Path  string `yaml:"path"`
}

Repo is a configuration struct to access a repo

type Server

type Server struct {
	Host  string `yaml:"host" default:"127.0.0.1"`
	Port  int    `yaml:"port" default:"8080"`
	Debug bool   `yaml:"debug"`
}

Server is the structure that holds the server configuration

type Service

type Service struct {
	Name string `yaml:"name"`
	Host string `yaml:"host"`
	URL  string `yaml:"url"`
	Icon string `yaml:"icon"`
	Own  bool   `yaml:"own"`

	CI   *CI   `yaml:"ci"`
	Repo *Repo `yaml:"repo"`
}

Service is a configuration struct describing a service

Jump to

Keyboard shortcuts

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