File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ version: 1.2.1
77additionalConfigs :
88 - config_env.yaml # For tokens and access keys
99 - database/connection_env.yaml # Connection data for mySQL databse
10+ - webserver/config.yaml # Config for the webserver
1011
1112# The language translation files to search for in 'data/lang/'
1213# The first one in this list will also be the fallback when trying to
@@ -109,9 +110,6 @@ event:
109110 # id:
110111 # animated: true
111112
112- webserver :
113- favicon : webserver/favicon.png
114-
115113twitch :
116114 name : c4e_bot
117115 channels :
Original file line number Diff line number Diff line change @@ -100,8 +100,7 @@ func main() {
100100 }
101101
102102 log .Println ("Starting webserver..." )
103- addr := ":8080"
104- webserver .Run (addr , webChan )
103+ webserver .Run (webChan )
105104
106105 // Wait to end the bot
107106 log .Println ("Press Ctrl+C to exit" )
Original file line number Diff line number Diff line change 1+ webserver :
2+ # The host on which the webserver is bound to
3+ # host:
4+ # The port on which the webserver listens
5+ port : 8080
6+ # The path to the favicon for the webserver
7+ favicon : webserver/favicon.png
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import (
1818 "cake4everybot/webserver/twitch"
1919 "cake4everybot/webserver/youtube"
2020 logger "log"
21+ "net"
2122 "net/http"
2223 "time"
2324
@@ -42,9 +43,10 @@ func initHTTP() http.Handler {
4243}
4344
4445// Run starts the webserver at the given address
45- func Run (addr string , webChan chan struct {}) {
46+ func Run (webChan chan struct {}) {
4647 handler := initHTTP ()
4748
49+ var addr string = net .JoinHostPort (viper .GetString ("webserver.host" ), viper .GetString ("webserver.port" ))
4850 var err error
4951
5052 go func () {
You can’t perform that action at this time.
0 commit comments