config

package
v0.0.0-...-600b74a Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2020 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Default = Config{
	Address:  "",
	Port:     8080,
	Password: "password",
	Database: Database{
		Host:     "localhost",
		User:     "postgres",
		Password: "",
		DBName:   "scoper",
		Port:     5432,
	},
}

Default config

View Source
var SuperUsers = make(map[string]string)

SuperUsers predefined list

Functions

This section is empty.

Types

type Config

type Config struct {
	Address  string   `json:"address" envconfig:"SERVER_ADDRESS"`
	Port     int      `json:"port" envconfig:"SERVER_PORT"`
	Password string   `json:"password"`
	Database Database `json:"database"`
}

Config of server

func Load

func Load(configPath string) (*Config, error)

Load config from file

func (Config) Dump

func (c Config) Dump()

Dump config info

type Database

type Database struct {
	Host     string `json:"host" envconfig:"DATABASE_HOST"`
	User     string `json:"user" envconfig:"DATABASE_USER"`
	Password string `json:"password" envconfig:"DATABASE_PASS"`
	DBName   string `json:"dbname" envconfig:"DATABASE_NAME"`
	Port     int    `json:"port" envconfig:"DATABASE_PORT"`
}

Database config

type User

type User struct {
	Password string `json:"password"`
	Role     string `json:"role"`
}

User entry

Jump to

Keyboard shortcuts

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