Removing TOML config references
This commit is contained in:
parent
4270573536
commit
c80e42287d
2 changed files with 5 additions and 21 deletions
|
@ -34,14 +34,13 @@ var (
|
|||
)
|
||||
|
||||
var (
|
||||
conf = flag.String("config", "drone.toml", "")
|
||||
debug = flag.Bool("debug", false, "")
|
||||
)
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
settings, err := config.Load(*conf)
|
||||
settings, err := config.Load()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
@ -55,6 +54,7 @@ func main() {
|
|||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
session := session.New(settings)
|
||||
eventbus_ := eventbus.New()
|
||||
queue_ := queue.New()
|
||||
|
|
|
@ -2,13 +2,11 @@ package config
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
log "github.com/drone/drone/Godeps/_workspace/src/github.com/Sirupsen/logrus"
|
||||
// "github.com/drone/drone/Godeps/_workspace/src/github.com/naoina/toml"
|
||||
"github.com/drone/drone/Godeps/_workspace/src/github.com/vrischmann/envconfig"
|
||||
)
|
||||
|
||||
|
@ -95,24 +93,10 @@ type Config struct {
|
|||
}
|
||||
}
|
||||
|
||||
// Load loads the configuration file and reads
|
||||
// parameters from environment variables.
|
||||
func Load(path string) (*Config, error) {
|
||||
data, err := ioutil.ReadFile(path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return LoadBytes(data)
|
||||
}
|
||||
|
||||
// LoadBytes reads the configuration file and
|
||||
// reads parameters from environment variables.
|
||||
func LoadBytes(data []byte) (*Config, error) {
|
||||
// Load loads the configuration from environment
|
||||
// variables.
|
||||
func Load() (*Config, error) {
|
||||
conf := &Config{}
|
||||
// err := toml.Unmarshal(data, conf)
|
||||
// if err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
err := envconfig.Init(conf)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Reference in a new issue