Skip to content

Commit

Permalink
fix: ensure api instance exists to avoid nil (#269)
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Gianelloni <wolf31o2@blinklabs.io>
  • Loading branch information
wolf31o2 authored Oct 30, 2024
1 parent beff557 commit cd853ca
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ func WithPort(port uint) APIOption {
}
}

var apiInstance *APIv1
// Initialize singleton API instance
var apiInstance = &APIv1{
engine: ConfigureRouter(true),
Host: "0.0.0.0",
Port: 8080,
}

var once sync.Once

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

0 comments on commit cd853ca

Please sign in to comment.