refactoring API and added dbs: postgres, bolt

This commit is contained in:
Pedro Nasser
2016-07-21 16:04:58 -03:00
parent edc126eb81
commit 66fa3d4035
19 changed files with 791 additions and 688 deletions

12
main.go
View File

@@ -11,23 +11,19 @@ import (
"os"
log "github.com/Sirupsen/logrus"
"github.com/iron-io/functions/api"
"github.com/iron-io/functions/api/server"
)
func main() {
config := &server.Config{}
config.DatabaseURL = os.Getenv("DB")
config := &api.Config{}
config.CloudFlare.Email = os.Getenv("CLOUDFLARE_EMAIL")
config.CloudFlare.ApiKey = os.Getenv("CLOUDFLARE_API_KEY")
config.CloudFlare.ZoneId = os.Getenv("CLOUDFLARE_ZONE_ID")
// TODO: validate inputs, iron tokens, cloudflare stuff, etc
err := config.Validate()
if err != nil {
log.WithError(err).Fatalln("Invalid config.")
}
log.Printf("config: %+v", config)
api := api.New(config)
api := server.New(config)
api.Start()
}