core

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

README

go-core

1. Environment Parser

You can now simple create env.yaml file with profile names (default, dev, local, etc.)

default:
    URL: http://test.com
    PORT: 80

dev:
    PORT: 8080

    #database
    DB_HOST: <url>
    DB_PORT: 1234
    DB_NAME: dbname
    DB_USER: dbuser
    DB_PASS: dbpass

And you can simple load env variables by:
core.LoadEnv(profiles...), example core.LoadEnv("dev")
Please note that default profile will be loaded automatically, no need to specify in LoadEnv as a parameter.

By default method will try to load file with name env.yaml. If your file name is different then use method
core.LoadEnvFile(filename, profiles...)

Limitations

Currently we support only one level of depth

profilename:           # 1st level is profilename
    URL: <url>         # 2nd level is env key:value property
    DATABASE:  
        URL: <url>     # 3rd level not allowed

2. Log Helpers

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadEnv

func LoadEnv(profiles ...string)

func LoadEnvFile

func LoadEnvFile(filename string, profiles ...string)

func LogrusFormatter

func LogrusFormatter(f *runtime.Frame) (string, string)

func LogrusJsonFmt

func LogrusJsonFmt() *logrus.JSONFormatter

func LogrusTextFmt

func LogrusTextFmt() *logrus.TextFormatter

Types

This section is empty.

Jump to

Keyboard shortcuts

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