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 (
|
var (
|
||||||
conf = flag.String("config", "drone.toml", "")
|
|
||||||
debug = flag.Bool("debug", false, "")
|
debug = flag.Bool("debug", false, "")
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
settings, err := config.Load(*conf)
|
settings, err := config.Load()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
@ -55,6 +54,7 @@ func main() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
session := session.New(settings)
|
session := session.New(settings)
|
||||||
eventbus_ := eventbus.New()
|
eventbus_ := eventbus.New()
|
||||||
queue_ := queue.New()
|
queue_ := queue.New()
|
||||||
|
|
|
@ -2,13 +2,11 @@ package config
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
log "github.com/drone/drone/Godeps/_workspace/src/github.com/Sirupsen/logrus"
|
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"
|
"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
|
// Load loads the configuration from environment
|
||||||
// parameters from environment variables.
|
// variables.
|
||||||
func Load(path string) (*Config, error) {
|
func Load() (*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) {
|
|
||||||
conf := &Config{}
|
conf := &Config{}
|
||||||
// err := toml.Unmarshal(data, conf)
|
|
||||||
// if err != nil {
|
|
||||||
// return nil, err
|
|
||||||
// }
|
|
||||||
err := envconfig.Init(conf)
|
err := envconfig.Init(conf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
Loading…
Reference in a new issue