Skip to content

Commit 8bb417c

Browse files
committed
Merge remote-tracking branch 'origin/main' into add-fmodel-endpoint
2 parents d493b82 + 50b6548 commit 8bb417c

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

src/otomi-stack.ts

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ export default class OtomiStack {
538538
const app = this.getApp(id)
539539
this.filterExcludedApp(app)
540540

541-
if (teamId === 'admin') return app
541+
if (teamId === 'admin') return this.filterAppSecrets(app)
542542
return { id: app.id, enabled: app.enabled }
543543
}
544544

@@ -564,7 +564,8 @@ export default class OtomiStack {
564564

565565
if (teamId === 'admin')
566566
return providerSpecificApps.map((app) => {
567-
return { ...app, enabled: Boolean(app.values?.enabled ?? true) } as App
567+
const filtered = this.filterAppSecrets(app)
568+
return { ...filtered, enabled: Boolean(app.values?.enabled ?? true) } as App
568569
})
569570

570571
const core = this.getCore()
@@ -574,7 +575,10 @@ export default class OtomiStack {
574575
const inTeamApps = !!core.teamApps.find((a) => a.name === app.id)
575576
if (isShared || inTeamApps) return app
576577
})
577-
.filter((app): app is App => app !== undefined) // Ensures no `undefined` elements
578+
.filter((app): app is App => app !== undefined)
579+
580+
// Filter secrets from team apps
581+
teamApps = teamApps.map((app) => this.filterAppSecrets(app))
578582

579583
if (!picks) return teamApps
580584

@@ -2333,6 +2337,25 @@ export default class OtomiStack {
23332337
return globalPaths.filter((path) => path.startsWith(appPrefix)).map((path) => path.replace(appPrefix, ''))
23342338
}
23352339

2340+
private filterAppSecrets(app: App): App {
2341+
if (!app.values) return app
2342+
2343+
const globalSecretPaths = getSecretPaths()
2344+
const appSecretPaths = this.extractAppSecretPaths(app.id, globalSecretPaths)
2345+
2346+
if (appSecretPaths.length === 0) return app
2347+
2348+
// Clone the app to avoid mutating original
2349+
const filteredApp = cloneDeep(app)
2350+
2351+
// Remove each secret path from the values
2352+
appSecretPaths.forEach((secretPath) => {
2353+
unset(filteredApp.values, secretPath)
2354+
})
2355+
2356+
return filteredApp
2357+
}
2358+
23362359
private extractSettingsSecretPaths(kind: AplKind, globalPaths: string[]): string[] {
23372360
const settingsPrefixMap: Record<string, string> = {
23382361
AplDns: 'dns.',

0 commit comments

Comments
 (0)