Skip to content
This repository has been archived by the owner on Feb 2, 2023. It is now read-only.

Commit

Permalink
CI, coverage and stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Lhussiez committed Nov 8, 2017
1 parent 447cde2 commit b274ca0
Show file tree
Hide file tree
Showing 5 changed files with 138 additions and 1 deletion.
21 changes: 21 additions & 0 deletions .drone.yml
@@ -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 ]
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -13,4 +13,4 @@


# Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736 # Project-local glide cache, RE: https://github.com/Masterminds/glide/issues/736
.glide/ .glide/

vendor/
57 changes: 57 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions Gopkg.toml
@@ -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"
29 changes: 29 additions & 0 deletions README.md
@@ -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)
}
```

0 comments on commit b274ca0

Please sign in to comment.