mirror of
https://github.com/ddworken/hishtory.git
synced 2025-02-22 13:31:11 +01:00
Add panic checking for impossible state in server struct
This commit is contained in:
parent
a66ea1387d
commit
bc4d2b05f1
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user