Skip to content

Commit

Permalink
chore: use a pointer for oauth app global value so it can be changed
Browse files Browse the repository at this point in the history
Without the pointer, it isn't possible to set the global value to false.

Signed-off-by: Donnie Adams <donnie@acorn.io>
  • Loading branch information
thedadams committed Jan 30, 2025
1 parent fd0b52a commit df5d048
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
4 changes: 2 additions & 2 deletions apiclient/types/oauthapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ type OAuthAppManifest struct {
OptionalScope string `json:"optionalScope,omitempty"`
// This field is required, it correlates to the integration name in the gptscript oauth cred tool
Alias string `json:"alias,omitempty"`
// Global indicates if the OAuth app is globally applied to all agents.
Global bool `json:"global,omitempty"`
// Global indicates if the OAuth app is globally applied to all agents. Defaults to false.
Global *bool `json:"global,omitempty"`
// This field is only used by Salesforce
InstanceURL string `json:"instanceURL,omitempty"`
}
Expand Down
5 changes: 5 additions & 0 deletions apiclient/types/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/gateway/types/oauth_apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ func MergeOAuthAppManifests(r, other types.OAuthAppManifest) types.OAuthAppManif
if other.OptionalScope != "" {
retVal.OptionalScope = other.OptionalScope
}
if other.Global {
if other.Global != nil {
retVal.Global = other.Global
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/render/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func OAuthAppEnv(ctx context.Context, db kclient.Client, oauthAppNames []string,
activeIntegrations := map[string]v1.OAuthApp{}
for _, name := range slices.Sorted(maps.Keys(apps)) {
app := apps[name]
if !app.Spec.Manifest.Global || app.Spec.Manifest.ClientID == "" || app.Spec.Manifest.ClientSecret == "" || app.Spec.Manifest.Alias == "" {
if app.Spec.Manifest.Global == nil || !*app.Spec.Manifest.Global || app.Spec.Manifest.ClientID == "" || app.Spec.Manifest.ClientSecret == "" || app.Spec.Manifest.Alias == "" {
continue
}
activeIntegrations[app.Spec.Manifest.Alias] = app
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/openapi/generated/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit df5d048

Please sign in to comment.