Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
edoger committed Apr 3, 2020
1 parent ab4fc5a commit c2c904f
Showing 1 changed file with 53 additions and 1 deletion.
54 changes: 53 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,56 @@
[![Coverage Status](https://coveralls.io/repos/github/edoger/zkits-environment/badge.svg?branch=master)](https://coveralls.io/github/edoger/zkits-environment?branch=master)
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/5b5f1e62d67846b3813fc77634b8dff3)](https://www.codacy.com/manual/edoger/zkits-environment?utm_source=github.com&utm_medium=referral&utm_content=edoger/zkits-environment&utm_campaign=Badge_Grade)

This package is a library of ZKits.
## About ##

This package is a library of ZKits project.
This library provides the function of managing the runtime environment for the application.
Generally, no additional work is needed to realize the type of runtime environment shared
between the various components of the application.

## Usage ##
1. Import package.
```sh
go get -u -v github.com/edoger/zkits-environment
```
2. Example.
```go
package main
import (
"flag"
"github.com/edoger/zkits-environment"
)
func main() {
var env string
flag.StringVar(&env, "env", "", "The runtime environment")
flag.Parse()
// Set the runtime environment value.
// If the given runtime environment is not registered, an error is returned.
err := environment.Set(environment.Env(env))
if err != nil {
// Handle error.
}
// Get the current runtime environment.
// If it has never been set, then you get the environment.Development by default.
environment.Get()
// Not enough built-in runtime environment?
// Register functions can register any custom runtime environment.
// Note: Registration must be before setup.
environment.Register("foo")
}
```
3. These are the runtime environments that are already built in and registered.
```
environment.Development // "development"
environment.Testing // "testing"
environment.Prerelease // "prerelease"
environment.Production // "production"
```
## License ##
[Apache-2.0](http://www.apache.org/licenses/LICENSE-2.0)

0 comments on commit c2c904f

Please sign in to comment.