diff --git a/internal/config/config.go b/internal/config/config.go index 8a1a939..20e50da 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -24,10 +24,11 @@ type Config struct { GithubClientID string GithubClientSecret string - UIDev bool - Env string - Debug bool - Swagger bool + UIDev bool + Env string + Debug bool + Swagger bool + SwaggerHost string } var ( @@ -52,6 +53,7 @@ func Load() (Config, error) { v.SetDefault("env", "development") v.SetDefault("debug", false) v.SetDefault("swagger", false) + v.SetDefault("swagger.host", "localhost:8080") // Env setup and binding v.SetEnvKeyReplacer(strings.NewReplacer(".", "_")) @@ -73,6 +75,7 @@ func Load() (Config, error) { "env", "debug", "swagger", + "swagger.host", } for _, k := range keys { _ = v.BindEnv(k) @@ -92,10 +95,11 @@ func Load() (Config, error) { GithubClientID: v.GetString("github.client.id"), GithubClientSecret: v.GetString("github.client.secret"), - UIDev: v.GetBool("ui.dev"), - Env: v.GetString("env"), - Debug: v.GetBool("debug"), - Swagger: v.GetBool("swagger"), + UIDev: v.GetBool("ui.dev"), + Env: v.GetString("env"), + Debug: v.GetBool("debug"), + Swagger: v.GetBool("swagger"), + SwaggerHost: v.GetString("swagger.host"), } // Validate diff --git a/internal/handlers/ssh_keys.go b/internal/handlers/ssh_keys.go index cbe3b7e..799c874 100644 --- a/internal/handlers/ssh_keys.go +++ b/internal/handlers/ssh_keys.go @@ -62,6 +62,9 @@ func ListPublicSshKeys(db *gorm.DB) http.HandlerFunc { return } + if out == nil { + out = []dto.SshResponse{} + } utils.WriteJSON(w, http.StatusOK, out) } } diff --git a/main.go b/main.go index 195599d..700a931 100644 --- a/main.go +++ b/main.go @@ -1,6 +1,12 @@ package main -import "github.com/glueops/autoglue/cmd" +import ( + "os" + + "github.com/glueops/autoglue/cmd" + "github.com/glueops/autoglue/docs" + "github.com/joho/godotenv" +) // @title AutoGlue API // @version 1.0 @@ -10,7 +16,6 @@ import "github.com/glueops/autoglue/cmd" // @BasePath /api/v1 // @schemes http https -// @host localhost:8080 // @securityDefinitions.apikey BearerAuth // @in header @@ -33,5 +38,7 @@ import "github.com/glueops/autoglue/cmd" // @description Org-level secret func main() { + _ = godotenv.Load() + docs.SwaggerInfo.Host = os.Getenv("SWAGGER_HOST") cmd.Execute() } diff --git a/ui/src/pages/ssh/ssh-page.tsx b/ui/src/pages/ssh/ssh-page.tsx index b96d624..c21e37e 100644 --- a/ui/src/pages/ssh/ssh-page.tsx +++ b/ui/src/pages/ssh/ssh-page.tsx @@ -307,7 +307,7 @@ export const SshPage = () => { Name - Public Key + Public Key Fingerprint Created Actions @@ -320,22 +320,19 @@ export const SshPage = () => { return ( {k.name || "—"} - -
- - {keyType} - - - - {truncated} - - -
-

{k.public_key}

-
-
-
-
+ + + + + {keyType} + + + +
+

{k.public_key}

+
+
+
{k.fingerprint} @@ -352,14 +349,14 @@ export const SshPage = () => {