All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
bind server to interface given by CLI option
21 lines
395 B
Go
21 lines
395 B
Go
package application
|
|
|
|
import (
|
|
"encoding/json"
|
|
"fmt"
|
|
"net/http"
|
|
)
|
|
|
|
func (app *Application) GetServerInfo(w http.ResponseWriter, r *http.Request) {
|
|
app.mu.Lock()
|
|
defer app.mu.Unlock()
|
|
|
|
serverInfo := ServerInfo{
|
|
IsInitialized: len(app.users) > 1,
|
|
}
|
|
|
|
w.Header().Add("Content-Type", "application/json")
|
|
jsonString, _ := json.Marshal(serverInfo)
|
|
fmt.Fprintf(w, "%s", string(jsonString))
|
|
}
|