Documentation ¶
Overview ¶
config package from micro-strter-kit import myConfig "github.com/xmlking/micro-starter-kit/shared/config" to `main.go` and all test files. then use Helper Methods `config.GetServiceConfig()` anywhere you need to retrieve `Configuration`
Index ¶
- Variables
- func CreateServerCerts() (tlsConfig *tls.Config, err error)
- func GetBuildInfo() string
- func GetConfig() configPB.Configuration
- func GetListener(endpoint string) (lis net.Listener, err error)
- func IsProduction() bool
- func IsSecure() bool
- func ParseTarget(target string) (ret resolver.Target)
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Configor *configor.Configor // Version is populated by govvv in compile-time. Version = "untouched" // BuildDate is populated by govvv. BuildDate string // GitCommit is populated by govvv. GitCommit string // GitBranch is populated by govvv. GitBranch string // GitState is populated by govvv. GitState string // GitSummary is populated by govvv. GitSummary string )
Functions ¶
func CreateServerCerts ¶ added in v0.3.2
func GetBuildInfo ¶
func GetBuildInfo() string
func GetConfig ¶ added in v0.3.2
func GetConfig() configPB.Configuration
Example ¶
package main import ( "fmt" "github.com/xmlking/micro-starter-kit/shared/config" ) func main() { fmt.Println(config.GetConfig().Email) // fmt.Println(config.GetConfig().Services["account"].Deadline) }
Output: username:"yourGmailUsername" password:"yourGmailAppPassword" email_server:"smtp.gmail.com" port:587 from:"xmlking-test@gmail.com"
Example (Check_defaults) ¶
package main import ( "fmt" "github.com/xmlking/micro-starter-kit/shared/config" ) func main() { fmt.Println(config.GetConfig().Services.Account.Endpoint) fmt.Println(config.GetConfig().Services.Account.Version) fmt.Println(config.GetConfig().Services.Account.Deadline) }
Output: mkit.service.account:8080 v0.1.0 8888
func IsProduction ¶
func IsProduction() bool
func ParseTarget ¶ added in v0.3.4
ParseTarget splits target into a resolver.Target struct containing scheme, authority and endpoint.
If target is not a valid scheme://authority/endpoint, it returns {Endpoint: target}.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.