Skip to content

Commit 4af598c

Browse files
andrasbacsaiclaude
andcommitted
fix: use is_buildtime JSON tag to match Coolify API response
The Coolify API returns `is_buildtime` (without underscore between build and time) in responses. Updated service tests to use the correct field name. Also simplified application env get command by removing preview filter. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 6ca3b70 commit 4af598c

File tree

2 files changed

+5
-19
lines changed

2 files changed

+5
-19
lines changed

cmd/application/env/get.go

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ func NewGetEnvCommand() *cobra.Command {
1414
cmd := &cobra.Command{
1515
Use: "get <app_uuid> <env_uuid_or_key>",
1616
Short: "Get environment variable details",
17-
Long: `Get detailed information about a specific environment variable by UUID or key name. By default, searches non-preview environment variables. Use --preview to search preview environment variables instead.`,
17+
Long: `Get detailed information about a specific environment variable by UUID or key name.`,
1818
Args: cli.ExactArgs(2, "<app_uuid> <env_uuid_or_key>"),
1919
RunE: func(cmd *cobra.Command, args []string) error {
2020
ctx := cmd.Context()
@@ -34,18 +34,6 @@ func NewGetEnvCommand() *cobra.Command {
3434
return fmt.Errorf("failed to get environment variable: %w", err)
3535
}
3636

37-
// Check if the result matches the preview filter
38-
showPreview, _ := cmd.Flags().GetBool("preview")
39-
if env.IsPreview != showPreview {
40-
// The found env doesn't match the preview filter
41-
// This can happen when searching by key and there are both preview and non-preview versions
42-
envType := "non-preview"
43-
if showPreview {
44-
envType = "preview"
45-
}
46-
return fmt.Errorf("environment variable '%s' not found in %s environment variables", envUUIDOrKey, envType)
47-
}
48-
4937
showSensitive, _ := cmd.Flags().GetBool("show-sensitive")
5038

5139
if !showSensitive {
@@ -68,7 +56,5 @@ func NewGetEnvCommand() *cobra.Command {
6856
},
6957
}
7058

71-
cmd.Flags().Bool("preview", false, "Search preview environment variables instead of regular ones")
72-
7359
return cmd
7460
}

internal/service/service_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,14 +255,14 @@ func TestService_ListEnvs(t *testing.T) {
255255
"uuid": "env-1",
256256
"key": "DATABASE_URL",
257257
"value": "postgres://localhost",
258-
"is_build_time": false,
258+
"is_buildtime": false,
259259
"is_preview": false
260260
},
261261
{
262262
"uuid": "env-2",
263263
"key": "API_KEY",
264264
"value": "secret",
265-
"is_build_time": true,
265+
"is_buildtime": true,
266266
"is_preview": false
267267
}
268268
]`))
@@ -290,7 +290,7 @@ func TestService_CreateEnv(t *testing.T) {
290290
"uuid": "env-new",
291291
"key": "NEW_VAR",
292292
"value": "new_value",
293-
"is_build_time": false,
293+
"is_buildtime": false,
294294
"is_preview": false
295295
}`))
296296
}))
@@ -319,7 +319,7 @@ func TestService_UpdateEnv(t *testing.T) {
319319
"uuid": "env-123",
320320
"key": "UPDATED_VAR",
321321
"value": "updated_value",
322-
"is_build_time": true,
322+
"is_buildtime": true,
323323
"is_preview": false
324324
}`))
325325
}))

0 commit comments

Comments
 (0)