Make env variables required

This commit is contained in:
Marc Di Luzio 2020-06-13 10:42:59 +01:00
parent 51030ac162
commit ccb34d4452
3 changed files with 8 additions and 5 deletions

View file

@ -106,6 +106,9 @@ func (s *Server) Initialise(fillWorld bool) (err error) {
s.sync.Add(1) s.sync.Add(1)
// Connect to the accountant // Connect to the accountant
if len(accountantAddress) == 0 {
log.Fatal("must set ACCOUNTANT_ADDRESS")
}
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())
if err != nil { if err != nil {

View file

@ -35,6 +35,10 @@ func InnerMain() {
return return
} }
if len(address) == 0 {
log.Fatalf("Must set HOST_ADDRESS")
}
log.Printf("Initialising version %s...\n", version.Version) log.Printf("Initialising version %s...\n", version.Version)
// Set the persistence path // Set the persistence path

View file

@ -12,15 +12,11 @@ import (
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
) )
const (
defaultAddress = "localhost:8080"
)
func Test_InnerMain(t *testing.T) { func Test_InnerMain(t *testing.T) {
var address = os.Getenv("ROVE_SERVER_ADDRESS") var address = os.Getenv("ROVE_SERVER_ADDRESS")
if len(address) == 0 { if len(address) == 0 {
address = defaultAddress log.Fatal("Must set ROVE_SERVER_ADDRESS")
} }
// Set up the flags to act locally and use a temporary file // Set up the flags to act locally and use a temporary file