Skip to content

Commit 50e9d27

Browse files
fix: change admin key validation from error to warning when not provided (#59)
* fix: change admin key validation from error to warning when not provided Previously, attempting to configure the OpenAI provider with a null admin_key would result in an error, making it impossible to use configurations where the admin key might be intentionally unset for certain environments or accounts. This change: - Changes the admin_key validation from an error to a warning when not provided - Only performs the sk-admin- prefix validation when an admin_key is actually provided - Enables common configurations like: ```hcl provider openai { admin_key = var.openai_api_key # where var.openai_api_key can be null } * Update internal/provider/provider.go Co-authored-by: Edd <edward.stephinson@gmail.com> --------- Co-authored-by: Edd <edward.stephinson@gmail.com>
1 parent cc770ef commit 50e9d27

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

internal/provider/provider.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ func (p *OpenAIProvider) Configure(ctx context.Context, req provider.ConfigureRe
8080
}
8181

8282
if adminKey == "" {
83-
resp.Diagnostics.AddError("admin_key is required", "admin_key is required")
84-
return
83+
resp.Diagnostics.AddWarning("admin_key is required", "admin_key is required")
8584
} else if !strings.HasPrefix(adminKey, "sk-admin-") {
8685
resp.Diagnostics.AddError("admin_key must start with 'sk-admin-'", "admin_key must start with 'sk-admin-'")
8786
return

0 commit comments

Comments
 (0)