add interface variable to settings

This commit is contained in:
tom whiston 2018-05-14 19:37:07 +00:00
parent 7503c81d8e
commit 373f3d1e8e
2 changed files with 7 additions and 1 deletions

View File

@ -36,6 +36,7 @@ func main() {
} }
fmt.Printf("Semaphore %v\n", util.Version) fmt.Printf("Semaphore %v\n", util.Version)
fmt.Printf("Interface %v\n", util.Config.Interface)
fmt.Printf("Port %v\n", util.Config.Port) fmt.Printf("Port %v\n", util.Config.Port)
fmt.Printf("MySQL %v@%v %v\n", util.Config.MySQL.Username, util.Config.MySQL.Hostname, util.Config.MySQL.DbName) fmt.Printf("MySQL %v@%v %v\n", util.Config.MySQL.Username, util.Config.MySQL.Hostname, util.Config.MySQL.DbName)
fmt.Printf("Tmp Path (projects home) %v\n", util.Config.TmpPath) fmt.Printf("Tmp Path (projects home) %v\n", util.Config.TmpPath)
@ -64,7 +65,7 @@ func main() {
var router http.Handler = api.Route() var router http.Handler = api.Route()
router = handlers.ProxyHeaders(router) router = handlers.ProxyHeaders(router)
http.Handle("/", router) http.Handle("/", router)
err := http.ListenAndServe(util.Config.Port, nil) err := http.ListenAndServe(util.Config.Interface+util.Config.Port, nil)
if err != nil { if err != nil {
log.Panic(err) log.Panic(err)
} }

View File

@ -49,8 +49,13 @@ type ldapMappings struct {
type configType struct { type configType struct {
MySQL mySQLConfig `json:"mysql"` MySQL mySQLConfig `json:"mysql"`
// Format `:port_num` eg, :3000 // Format `:port_num` eg, :3000
// if : is missing it will be corrected
Port string `json:"port"` Port string `json:"port"`
// Interface ip, put in front of the port.
// defaults to empty
Interface string `json:"interface"`
// semaphore stores ephemeral projects here // semaphore stores ephemeral projects here
TmpPath string `json:"tmp_path"` TmpPath string `json:"tmp_path"`