This repository has been archived by the owner on Feb 2, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Paul Lhussiez
committed
Nov 8, 2017
1 parent
447cde2
commit b274ca0
Showing
5 changed files
with
138 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,21 @@ | |||
workspace: | |||
base: /go | |||
path: src/github.com/Dpado/conftags/ | |||
|
|||
pipeline: | |||
# Dep and vendoring | |||
prerequisites: | |||
image: golang:1.9 | |||
commands: | |||
- go get -u github.com/golang/dep/cmd/dep | |||
- dep ensure | |||
|
|||
# Test | |||
test: | |||
image: golang:1.9 | |||
commands: | |||
- go test -race -coverprofile=coverage.txt -covermode=atomic | |||
|
|||
codecov: | |||
image: robertstettner/drone-codecov | |||
secrets: [ codecov_token ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,30 @@ | |||
|
|||
# Gopkg.toml example | |||
# | |||
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md | |||
# for detailed Gopkg.toml documentation. | |||
# | |||
# required = ["github.com/user/thing/cmd/thing"] | |||
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"] | |||
# | |||
# [[constraint]] | |||
# name = "github.com/user/project" | |||
# version = "1.0.0" | |||
# | |||
# [[constraint]] | |||
# name = "github.com/user/project2" | |||
# branch = "dev" | |||
# source = "github.com/myfork/project2" | |||
# | |||
# [[override]] | |||
# name = "github.com/x/y" | |||
# version = "2.4.0" | |||
|
|||
|
|||
[[constraint]] | |||
branch = "master" | |||
name = "github.com/alecthomas/assert" | |||
|
|||
[[constraint]] | |||
name = "github.com/sirupsen/logrus" | |||
version = "1.0.3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,2 +1,31 @@ | |||
# conftags | # conftags | ||
|
|
||
![Go Version](https://img.shields.io/badge/go-1.8-brightgreen.svg) | |||
![Go Version](https://img.shields.io/badge/go-1.9-brightgreen.svg) | |||
[![Go Report Card](https://goreportcard.com/badge/github.com/Depado/conftags)](https://goreportcard.com/report/github.com/Depado/conftags) | |||
[![Build Status](https://drone.depado.eu/api/badges/Depado/conftags/status.svg)](https://drone.depado.eu/Depado/conftags) | |||
[![codecov](https://codecov.io/gh/Depado/conftags/branch/master/graph/badge.svg)](https://codecov.io/gh/Depado/conftags) | |||
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/Depado/bfchroma/blob/master/LICENSE) | |||
|
|||
Similar to [github.com/caarlos0/env](https://github.com/caarlos0/env) but with | |||
default decoupled from environment. It also doesn't support slices. | |||
|
|||
This library intends to work as the last step in the filling of a configuration | |||
struct. Assuming that environment variables are the highest priority | |||
configuration values, you could first parse a configuration file, and then parse | |||
this struct with this library. The last resort is the default which will fill | |||
the struct field only if it has the zero value for its own type. | |||
|
|||
## Usage | |||
|
|||
```go | |||
type MyConf struct { | |||
Int int `env:"INT" default:"10"` | |||
String string `env:"STRING"` | |||
Duration time.Duration `env:"DURATION" default:"1h"` | |||
} | |||
|
|||
func (ms *MyConf) Parse() error { | |||
return conftags.Parse(ms) | |||
} | |||
``` |