add ability to store/create encrypted vcenter password
Some checks are pending
CI / Lint (push) Waiting to run
CI / Test (push) Waiting to run
CI / End-to-End (push) Waiting to run
CI / Publish Docker (push) Blocked by required conditions
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-09-27 17:02:02 +10:00
parent 5a00f4a8c7
commit 3501967c9e
13 changed files with 235 additions and 772 deletions

View File

@@ -5,17 +5,21 @@ import (
"net/http"
"vctp/db"
"vctp/dist"
"vctp/internal/secrets"
"vctp/internal/vcenter"
"vctp/server/handler"
"vctp/server/middleware"
)
func New(logger *slog.Logger, database db.Database, buildTime string, sha1ver string, goVersion string) http.Handler {
func New(logger *slog.Logger, database db.Database, buildTime string, sha1ver string, goVersion string, creds *vcenter.VcenterLogin, secret *secrets.Secrets) http.Handler {
h := &handler.Handler{
Logger: logger,
Database: database,
BuildTime: buildTime,
SHA1Ver: sha1ver,
GoVersion: goVersion,
VcCreds: creds,
Secret: secret,
}
mux := http.NewServeMux()
@@ -35,5 +39,8 @@ func New(logger *slog.Logger, database db.Database, buildTime string, sha1ver st
mux.HandleFunc("/api/report/inventory", h.InventoryReportDownload)
mux.HandleFunc("/api/report/updates", h.UpdateReportDownload)
// endpoint for encrypting vcenter credential
mux.HandleFunc("/api/encrypt", h.EncryptData)
return middleware.NewLoggingMiddleware(logger, mux)
}