M README.md => README.md +2 -2
@@ 9,8 9,8 @@ Code for [10man](https://hub.xenrox.net/~xenrox/10man/) API.
Your config file should be placed at `/etc/10man-api/config`.
```
-# Port
-port 8080
+# http listen address
+http-address 127.0.0.1:8080
# Connection string for the database (required)
connection-string postgresql://user:pass@localhost/db?sslmode=disable
# Comma separated list of steamID64 for users that should become an admin
M config/config.go => config/config.go +4 -4
@@ 8,7 8,7 @@ import (
)
type Config struct {
- Port string
+ HTTPAddress string
DBConnectionString string
LogLevel string
Admins []string
@@ 23,12 23,12 @@ func ReadConfig(path string) (*Config, error) {
config := new(Config)
// Set default values
- config.Port = "8080"
+ config.HTTPAddress = "127.0.0.1:8080"
config.LogLevel = "info"
- d := cfg.Get("port")
+ d := cfg.Get("http-address")
if d != nil {
- if err := d.ParseParams(&config.Port); err != nil {
+ if err := d.ParseParams(&config.HTTPAddress); err != nil {
return nil, err
}
}
M server.go => server.go +1 -1
@@ 50,7 50,7 @@ func main() {
http.Handle("/query", srv)
go func() {
- logger.Fatal(http.ListenAndServe(":"+cfg.Port, nil))
+ logger.Fatal(http.ListenAndServe(cfg.HTTPAddress, nil))
}()
shutdown(<-sigs, db, logger)