package
1.1.0
Repository: https://github.com/45hur/go-contrib.git
Documentation: pkg.go.dev

# README

Properties Module

GoDoc

A centralized configuration endpoint.

Why ?

We have a lot configuration possibilities with Golang, we need something open with large capabilities like Merge, subset, provider order, flags; and completly integrate with standard tools like Consul and etcd.

How ?

To simplify, it's a spf13/Viper extension and helper.

Usages

Take a look at functional properties_test.go in properties_test and properties_test.go in properties unit test.

Sample usage can be resume at :

To read Mode from command line and by default "prod", where resx is configuration directory store with app.json and prod.app.json . app.json and prod.app.json (or any profile as command line argument) will be merge.

''' // Create a configuration Object with default Env and flags c := properties.DefaultConfig() // customize some default value c.ConfigPathes = []string{"common/configs/server"} c.DefaultConfigMode = "production" // here a production.app.json will be search instead of prod.app.json

// Read flags, env, remote... and load properties
props := properties.New(c)
// load and merge mode properties
props.LoadModeProperties(true)

'''

Can be use to unmarshal any configuration from spf13/Viper:


type DummyConfig struct {
		BaseUrl    string
		SuccessUrl string
	}

    var C DummyConfig

	err := props.Unmarshal(&C)
	

Add some functions, like GetOrDie, GetStringOrDefault, ...etc.

# Functions

CheckRunInTestEnvironment return true if this application is running with 'go test'.
DefaultConfig return a default configuration with Flags and Env already set...
Properties constructor Settings default values if need.
No description provided by the author

# Constants

Flags Tag referrer e.g.
Flags Tag referrer e.g.
Flags Tag referrer e.g.
Default config storage directory.
Default config mode.
Default config file name.
Default config type.
Default test config mode spelling.
Flags Tag referrer e.g.

# Structs

Config is a struct that allows to initialize the Properties type with user defined values.
Flag is a struct that stores flags configuration.
Properties is a struct that allow to handle application properties seting and acessing.
Privider is a struct that hold remote providers data.