Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/api/v1/settings/{settingId}.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Debug from 'debug'
import { Response } from 'express'
import { OpenApiRequestExt, Settings } from 'src/otomi-models'
import { omit } from 'lodash'

const debug = Debug('otomi:api:v1:settings')

Expand All @@ -13,5 +14,9 @@ export const editSettings = async (req: OpenApiRequestExt, res: Response): Promi
const ids = Object.keys(req.body as Settings)
debug(`editSettings(${ids.join(',')})`)
const v = await req.otomi.editSettings(req.body as Settings, settingId)
res.json(v)
if (v?.otomi) {
res.json(omit(v, ['otomi.adminPassword', 'otomi.git.password']))
} else {
res.json(v)
}
}
1 change: 0 additions & 1 deletion src/openapi/settings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ Settings:
required:
- repoUrl
- username
- password
- email
- branch
adminPassword:
Expand Down
8 changes: 6 additions & 2 deletions src/otomi-stack.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CoreV1Api, User as k8sUser, KubeConfig, V1ObjectReference } from '@kubernetes/client-node'
import { CoreV1Api, KubeConfig, User as k8sUser, V1ObjectReference } from '@kubernetes/client-node'
import Debug from 'debug'

import { getRegions, ObjectStorageKeyRegions } from '@linode/api-v4'
Expand Down Expand Up @@ -503,11 +503,15 @@ export default class OtomiStack {
const settings = this.getSettings()
await this.editIngressApps(settings, data, settingId)
const updatedSettingsData: any = { ...data }
// Preserve the otomi.adminPassword when editing otomi settings
// Preserve the otomi.adminPassword and otomi.git.password if not present when editing otomi settings
if (settingId === 'otomi') {
updatedSettingsData.otomi = {
...updatedSettingsData.otomi,
adminPassword: settings.otomi?.adminPassword,
git: {
...updatedSettingsData.otomi?.git,
...(!updatedSettingsData.otomi?.git?.password && { password: settings.otomi?.git?.password }),
},
}
// convert otomi.nodeSelector to object
if (Array.isArray(updatedSettingsData.otomi.nodeSelector)) {
Expand Down
Loading