forked from harness/harness
-
Notifications
You must be signed in to change notification settings - Fork 0
/
drone.go
59 lines (47 loc) · 1.29 KB
/
drone.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package main
import (
"flag"
"github.com/CiscoCloud/drone/engine"
"github.com/CiscoCloud/drone/remote"
"github.com/CiscoCloud/drone/router"
"github.com/CiscoCloud/drone/router/middleware/cache"
"github.com/CiscoCloud/drone/router/middleware/context"
"github.com/CiscoCloud/drone/router/middleware/header"
"github.com/CiscoCloud/drone/shared/envconfig"
"github.com/CiscoCloud/drone/shared/server"
"github.com/CiscoCloud/drone/store/datastore"
"github.com/Sirupsen/logrus"
)
// build revision number populated by the continuous
// integration server at compile time.
var build string = "custom"
var (
dotenv = flag.String("config", ".env", "")
debug = flag.Bool("debug", false, "")
)
func main() {
flag.Parse()
// debug level if requested by user
if *debug {
logrus.SetLevel(logrus.DebugLevel)
}
// Load the configuration from env file
env := envconfig.Load(*dotenv)
// Setup the database driver
store_ := datastore.Load(env)
// setup the remote driver
remote_ := remote.Load(env)
// setup the runner
engine_ := engine.Load(env, store_)
// setup the server and start the listener
server_ := server.Load(env)
server_.Run(
router.Load(
header.Version(build),
cache.Default(),
context.SetStore(store_),
context.SetRemote(remote_),
context.SetEngine(engine_),
),
)
}