mirror of
https://github.com/fosrl/olm.git
synced 2026-02-24 13:56:44 +00:00
Break out start and stop API
This commit is contained in:
24
olm/olm.go
24
olm/olm.go
@@ -101,10 +101,6 @@ func Init(ctx context.Context, config GlobalConfig) {
|
||||
|
||||
apiServer.SetVersion(config.Version)
|
||||
|
||||
if err := apiServer.Start(); err != nil {
|
||||
logger.Fatal("Failed to start HTTP server: %v", err)
|
||||
}
|
||||
|
||||
// Set up API handlers
|
||||
apiServer.SetHandlers(
|
||||
// onConnect
|
||||
@@ -907,3 +903,23 @@ func StopTunnel() {
|
||||
|
||||
logger.Info("Tunnel process stopped")
|
||||
}
|
||||
|
||||
func StopApi() error {
|
||||
if apiServer != nil {
|
||||
err := apiServer.Stop()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to stop API server: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func StartApi() error {
|
||||
if apiServer != nil {
|
||||
err := apiServer.Start()
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to start API server: %w", err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user