kesslercfg

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2019 License: MIT Imports: 3 Imported by: 0

README

kesslercfg

A Go package for loading database configuration values from a json file.

Example usage

Create a config

cfg := kesslercfg.LoadConfig("config.json")

Example of json config
{
    "database": {
        "user": "owo",
        "dbname": "owoDB",
        "password": "password",
        "host": "localhost",
        "port": "3306"
    }
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Database struct {
		User     string `json:"user"`
		Host     string `json:"host"`
		Port     string `json:"port"`
		DBName   string `json:"dbname"`
		Password string `json:"password"`
	} `json:"database"`
	SecretKey string `json:"secretkey"`
}

Config holds configuration values

func LoadConfig

func LoadConfig(file string) Config

LoadConfig takes a file and returns a config

Jump to

Keyboard shortcuts

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