Add panic checking for impossible state in server struct

This commit is contained in:
David Dworken 2023-09-13 21:51:23 -07:00
parent a66ea1387d
commit bc4d2b05f1
No known key found for this signature in database

View File

@ -73,6 +73,9 @@ func NewServer(db *database.DB, options ...Option) *Server {
for _, option := range options {
option(&srv)
}
if srv.isProductionEnvironment && srv.isTestEnvironment {
panic(fmt.Errorf("cannot create a server that is both a prod environment and a test environment: %#v", srv))
}
return &srv
}