Skip to content

Commit

Permalink
make default localhost:80, split api_uri param
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Klaas committed Dec 28, 2022
1 parent 84020b2 commit a9aaa1f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 6 additions & 3 deletions imls-wifi-sensor/internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,11 @@ func createURI(what string) string {
scheme := viper.GetString("api.scheme")
host := viper.GetString("api.host")
port := viper.GetInt("api.port")
api_uri := viper.GetString("api.api_uri")
fullURI := (scheme + "://" +
strings.TrimSuffix(strings.TrimPrefix(host, "/"), "/") +
":" + fmt.Sprint(port) + "/" +
strings.TrimPrefix(api_uri, "/")) + "/" +
strings.TrimPrefix(what, "/"))
log.Info().Msg("FULL URI: " + fullURI)
return (fullURI)
Expand Down Expand Up @@ -209,9 +211,10 @@ func SetConfigDefaults() {
viper.SetDefault("log.level", "DEBUG")
viper.SetDefault("log.loggers", "local:stderr,local:tmp")
viper.SetDefault("mode.run", "prod")
viper.SetDefault("api.scheme", "https")
viper.SetDefault("api.host", "rabbit-phase-4.app.cloud.gov")
viper.SetDefault("api.port", 443)
viper.SetDefault("api.scheme", "http")
viper.SetDefault("api.host", "localhost")
viper.SetDefault("api.port", 80)
viper.SetDefault("api.api_uri", "")
viper.SetDefault("api.login_uri", "/rpc/login")
viper.SetDefault("api.heartbeat_uri", "/rpc/beat_the_heart")
viper.SetDefault("api.presences_uri", "/rpc/update_presence")
Expand Down
5 changes: 3 additions & 2 deletions imls-windows-installer/session-counter.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
host=statspilot.galibs.org
scheme=https
port=443
presences_uri=/api/rpc/update_presence
heartbeat_uri=/api/rpc/beat_the_heart
api_uri=/api
presences_uri=/rpc/update_presence
heartbeat_uri=/rpc/beat_the_heart
login_uri=/rpc/login

[config]
Expand Down

0 comments on commit a9aaa1f

Please sign in to comment.