Make the ports have default values

This commit is contained in:
Marc Di Luzio 2020-06-23 00:05:26 +01:00
parent 9fb0a79480
commit dd76e61e44
4 changed files with 28 additions and 19 deletions

View file

@ -82,14 +82,17 @@ func (a *accountantServer) GetValue(_ context.Context, in *accounts.DataKey) (*a
// main
func main() {
// Verify the input
// Get the port
var iport int
var port = os.Getenv("PORT")
if len(port) == 0 {
log.Fatal("Must set $PORT")
}
iport, err := strconv.Atoi(port)
if err != nil {
log.Fatal("$PORT not valid int")
iport = 9091
} else {
var err error
iport, err = strconv.Atoi(port)
if err != nil {
log.Fatal("$PORT not valid int")
}
}
persistence.SetPath(data)