-
Notifications
You must be signed in to change notification settings - Fork 324
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from hellofresh/feature/config
Fixing the config
- Loading branch information
Showing
12 changed files
with
144 additions
and
163 deletions.
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
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package config | ||
|
||
import "github.com/kelseyhightower/envconfig" | ||
|
||
// Specification for basic configurations | ||
type Specification struct { | ||
DatabaseDSN string `envconfig:"DATABASE_DSN"` | ||
Port int `envconfig:"PORT"` | ||
Debug bool `envconfig:"DEBUG"` | ||
StorageDSN string `envconfig:"REDIS_DSN"` | ||
} | ||
|
||
//LoadEnv loads environment variables | ||
func LoadEnv() (*Specification, error) { | ||
var config Specification | ||
err := envconfig.Process("", &config) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return &config, nil | ||
} |
This file was deleted.
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package errors | ||
|
||
type Error struct { | ||
Code int | ||
message string | ||
} | ||
|
||
func New(code int, message string) *Error { | ||
return &Error{code, message} | ||
} | ||
|
||
func (e Error) Error() string { | ||
return e.message | ||
} |
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 | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
package: github.com/hellofresh/api-gateway | ||
license: MIT | ||
owners: | ||
- name: Italo Lelis de Vietro | ||
email: [email protected] | ||
import: | ||
- package: github.com/RangelReale/osin | ||
- package: github.com/Sirupsen/logrus | ||
version: ^0.10.0 | ||
- package: github.com/asaskevich/govalidator | ||
version: ^4.0.0 | ||
- package: github.com/etcinit/speedbump | ||
version: ^0.2.0 | ||
- package: github.com/gin-gonic/gin | ||
version: 9163ee543d3f1fab9b0ad8cdf6dc2a6ec2c07dbb | ||
- package: github.com/gorilla/context | ||
version: ^1.1.0 | ||
version: v1.0-rc.2 | ||
- package: github.com/kelseyhightower/envconfig | ||
version: ^1.1.0 | ||
- package: gopkg.in/mgo.v2 | ||
|
@@ -20,5 +21,7 @@ import: | |
version: ^3.6.4 | ||
- package: github.com/itsjamie/gin-cors | ||
version: ^1.0.0 | ||
- package: github.com/hellofresh/ginger-middleware | ||
testImport: | ||
- package: github.com/onsi/ginkgo | ||
version: ^1.2.0 | ||
version: ^1.2.0 |
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
Oops, something went wrong.