-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.go
More file actions
32 lines (26 loc) · 833 Bytes
/
server.go
File metadata and controls
32 lines (26 loc) · 833 Bytes
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
package main
import (
"github.com/GoPex/caretaker/engine"
"github.com/GoPex/caretaker/helpers"
)
func main() {
// Create a new Unleash application
application := engine.New()
// Parse the configuration
config, err := helpers.ParseConfiguration()
if err != nil {
panic("Not able to parse the configuration ! Cause: " + err.Error())
}
// Initialize the application
if err = application.Initialize(&config); err != nil {
panic("Not able to initialize the application ! Cause: " + err.Error())
}
// Check the configuration
if application.Config.Port == "" {
panic("No port was given !")
}
// Listen and serve on port defined by environment variable UNLEASH_PORT
if err := application.Engine.Run(":" + application.Config.Port); err != nil {
panic("Error while starting unleash ! Cause: " + err.Error())
}
}