mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2025-12-15 03:36:16 +01:00
Review refactored code
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
// All rights reserved. This file is part of cc-backend.
|
// All rights reserved. This file is part of cc-backend.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// Package main provides the entry point for the ClusterCockpit backend server.
|
// Package main provides the entry point for the ClusterCockpit backend server.
|
||||||
// This file defines all command-line flags and their default values.
|
// This file defines all command-line flags and their default values.
|
||||||
package main
|
package main
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
// All rights reserved. This file is part of cc-backend.
|
// All rights reserved. This file is part of cc-backend.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// Package main provides the entry point for the ClusterCockpit backend server.
|
// Package main provides the entry point for the ClusterCockpit backend server.
|
||||||
// This file contains bootstrap logic for initializing the environment,
|
// This file contains bootstrap logic for initializing the environment,
|
||||||
// creating default configuration files, and setting up the database.
|
// creating default configuration files, and setting up the database.
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
// All rights reserved. This file is part of cc-backend.
|
// All rights reserved. This file is part of cc-backend.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// Package main provides the entry point for the ClusterCockpit backend server.
|
// Package main provides the entry point for the ClusterCockpit backend server.
|
||||||
// It orchestrates initialization of all subsystems including configuration,
|
// It orchestrates initialization of all subsystems including configuration,
|
||||||
// database, authentication, and the HTTP server.
|
// database, authentication, and the HTTP server.
|
||||||
@@ -266,7 +267,7 @@ func generateJWT(authHandle *auth.Authentication, username string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func initSubsystems() error {
|
func initSubsystems() error {
|
||||||
// Initialize archive
|
// Initialize job archive
|
||||||
archiveCfg := ccconf.GetPackageConfig("archive")
|
archiveCfg := ccconf.GetPackageConfig("archive")
|
||||||
if archiveCfg == nil {
|
if archiveCfg == nil {
|
||||||
archiveCfg = json.RawMessage(defaultArchiveConfig)
|
archiveCfg = json.RawMessage(defaultArchiveConfig)
|
||||||
@@ -399,7 +400,6 @@ func runServer(ctx context.Context) error {
|
|||||||
func run() error {
|
func run() error {
|
||||||
cliInit()
|
cliInit()
|
||||||
|
|
||||||
// Handle version flag
|
|
||||||
if flagVersion {
|
if flagVersion {
|
||||||
printVersion()
|
printVersion()
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -116,6 +116,11 @@ func (api *RestApi) MountMetricStoreApiRoutes(r *mux.Router) {
|
|||||||
r.HandleFunc("/api/write", writeMetrics).Methods(http.MethodPost)
|
r.HandleFunc("/api/write", writeMetrics).Methods(http.MethodPost)
|
||||||
r.HandleFunc("/api/debug", debugMetrics).Methods(http.MethodGet)
|
r.HandleFunc("/api/debug", debugMetrics).Methods(http.MethodGet)
|
||||||
r.HandleFunc("/api/healthcheck", metricsHealth).Methods(http.MethodGet)
|
r.HandleFunc("/api/healthcheck", metricsHealth).Methods(http.MethodGet)
|
||||||
|
// Same endpoints but with trailing slash
|
||||||
|
r.HandleFunc("/api/free/", freeMetrics).Methods(http.MethodPost)
|
||||||
|
r.HandleFunc("/api/write/", writeMetrics).Methods(http.MethodPost)
|
||||||
|
r.HandleFunc("/api/debug/", debugMetrics).Methods(http.MethodGet)
|
||||||
|
r.HandleFunc("/api/healthcheck/", metricsHealth).Methods(http.MethodGet)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (api *RestApi) MountConfigApiRoutes(r *mux.Router) {
|
func (api *RestApi) MountConfigApiRoutes(r *mux.Router) {
|
||||||
|
|||||||
Reference in New Issue
Block a user