Skip to content

Commit cd853ca

Browse files
authored
fix: ensure api instance exists to avoid nil (#269)
Signed-off-by: Chris Gianelloni <[email protected]>
1 parent beff557 commit cd853ca

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

api/api.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,13 @@ func WithPort(port uint) APIOption {
5050
}
5151
}
5252

53-
var apiInstance *APIv1
53+
// Initialize singleton API instance
54+
var apiInstance = &APIv1{
55+
engine: ConfigureRouter(true),
56+
Host: "0.0.0.0",
57+
Port: 8080,
58+
}
59+
5460
var once sync.Once
5561

5662
func New(debug bool, options ...APIOption) *APIv1 {

0 commit comments

Comments
 (0)