cfg

package
v0.0.0-...-ac04cce Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2016 License: GPL-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package cfg implements a simple config parser from YML config file.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckErr

func CheckErr(err error, msg string)

Types

type Config

type Config struct {
	APP_PORT       string `yaml:"app_port"`
	DB_USERNAME    string `yaml:"db_username"`
	DB_PASSWORD    string `yaml:"db_password"`
	DB_NAME        string `yaml:"db_name"`
	DB_ADDRESS     string `yaml:"db_address"`
	DB_SSLMODE     string `yaml:"db_ssh_mode"`
	DB_PORT        string `yaml:"db_port"`
	RELEASE_MODE   bool   `yaml:"release_mode"`
	SECRET_KEY     string `yaml:"secret_key"`
	TOKEN_LIFETIME int64  `yaml:"token_lifetime"`
	DB_LOG         bool   `yaml:"db_log"`
}

Structure for yaml config parameters:

APP_PORT			- application port
DB_USERNAME			- username for DB connection
DB_PASSWORD			- paassword for DB connection
DB_NAME				- Database Name for DB connection
DB_ADDRESS			- IP address for DB connection
DB_SSLMODE			- enable/disable SSH mode in DB connection
DB_PORT				- port for DB connection
SECRET_KEY 			- path to secret kry
TOKEN_LIFETIME 		- time in sedonds for vailid token.
ACCESS_CONTROL_ALLOW_ORIGIN	- this option for CORS requests see https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS

func GetConfig

func GetConfig(yamlPath string) (Config, error)

func Init

func Init() Config

initialize confi, load and perse it, or user defaukr values.

Jump to

Keyboard shortcuts

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