Make the ports have default values
This commit is contained in:
parent
9fb0a79480
commit
dd76e61e44
4 changed files with 28 additions and 19 deletions
|
@ -82,15 +82,18 @@ func (a *accountantServer) GetValue(_ context.Context, in *accounts.DataKey) (*a
|
||||||
|
|
||||||
// main
|
// main
|
||||||
func main() {
|
func main() {
|
||||||
// Verify the input
|
// Get the port
|
||||||
|
var iport int
|
||||||
var port = os.Getenv("PORT")
|
var port = os.Getenv("PORT")
|
||||||
if len(port) == 0 {
|
if len(port) == 0 {
|
||||||
log.Fatal("Must set $PORT")
|
iport = 9091
|
||||||
}
|
} else {
|
||||||
iport, err := strconv.Atoi(port)
|
var err error
|
||||||
|
iport, err = strconv.Atoi(port)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("$PORT not valid int")
|
log.Fatal("$PORT not valid int")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
persistence.SetPath(data)
|
persistence.SetPath(data)
|
||||||
|
|
||||||
|
|
|
@ -21,17 +21,20 @@ func main() {
|
||||||
|
|
||||||
var endpoint = os.Getenv("ROVE_GRPC")
|
var endpoint = os.Getenv("ROVE_GRPC")
|
||||||
if len(endpoint) == 0 {
|
if len(endpoint) == 0 {
|
||||||
log.Fatal("Must set $ROVE_GRPC")
|
endpoint = "localhost:9090"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var iport int
|
||||||
var port = os.Getenv("PORT")
|
var port = os.Getenv("PORT")
|
||||||
if len(port) == 0 {
|
if len(port) == 0 {
|
||||||
log.Fatal("Must set $PORT")
|
iport = 8080
|
||||||
}
|
} else {
|
||||||
iport, err := strconv.Atoi(port)
|
var err error
|
||||||
|
iport, err = strconv.Atoi(port)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("$PORT not valid int")
|
log.Fatal("$PORT not valid int")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Create a new mux and register it with the gRPC endpoint
|
// Create a new mux and register it with the gRPC endpoint
|
||||||
fmt.Printf("Hosting reverse-proxy on %d for %s\n", iport, endpoint)
|
fmt.Printf("Hosting reverse-proxy on %d for %s\n", iport, endpoint)
|
||||||
|
|
|
@ -106,7 +106,7 @@ func (s *Server) Initialise(fillWorld bool) (err error) {
|
||||||
// Connect to the accountant
|
// Connect to the accountant
|
||||||
accountantAddress := os.Getenv("ROVE_ACCOUNTANT_GRPC")
|
accountantAddress := os.Getenv("ROVE_ACCOUNTANT_GRPC")
|
||||||
if len(accountantAddress) == 0 {
|
if len(accountantAddress) == 0 {
|
||||||
log.Fatal("must set $ROVE_ACCOUNTANT_GRPC")
|
accountantAddress = "localhost:9091"
|
||||||
}
|
}
|
||||||
log.Printf("Dialing accountant on %s\n", accountantAddress)
|
log.Printf("Dialing accountant on %s\n", accountantAddress)
|
||||||
s.clientConn, err = grpc.Dial(accountantAddress, grpc.WithInsecure())
|
s.clientConn, err = grpc.Dial(accountantAddress, grpc.WithInsecure())
|
||||||
|
|
|
@ -31,15 +31,18 @@ func InnerMain() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Address to host the server on, automatically selected if empty
|
// Address to host the server on
|
||||||
|
var iport int
|
||||||
var port = os.Getenv("PORT")
|
var port = os.Getenv("PORT")
|
||||||
if len(port) == 0 {
|
if len(port) == 0 {
|
||||||
log.Fatal("Must set $PORT")
|
iport = 9090
|
||||||
}
|
} else {
|
||||||
iport, err := strconv.Atoi(port)
|
var err error
|
||||||
|
iport, err = strconv.Atoi(port)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal("$PORT not valid int")
|
log.Fatal("$PORT not valid int")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
log.Printf("Initialising version %s...\n", version.Version)
|
log.Printf("Initialising version %s...\n", version.Version)
|
||||||
|
|
||||||
// Set the persistence path
|
// Set the persistence path
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue