@@ -708,8 +708,17 @@ export default class OtomiStack {
708708 } ) : Promise < void > {
709709 const { otomi } = await this . getSettings ( )
710710 const updatedOtomi = buildUpdatedOtomiSettings ( otomi , params )
711+
712+ // Encrypt the password into the otomi-secrets SealedSecret and strip it from the settings YAML
713+ const sealedSecretRecord = await this . extractAndStoreSettingsSecrets ( 'otomi' , { otomi : updatedOtomi } )
714+ const valuesSchema = await getValuesSchema ( )
715+ const subSchema = valuesSchema . properties ?. otomi
716+ if ( subSchema ) {
717+ removeSettingsSecrets ( extractSecretPaths ( subSchema ) , updatedOtomi )
718+ }
719+
711720 const { filePath, aplObject } = await this . persistOtomiSettings ( updatedOtomi )
712- await this . commitAndPushMigration ( { ...params , filePath, aplObject } )
721+ await this . commitAndPushMigration ( { ...params , filePath, aplObject, sealedSecretRecord } )
713722 }
714723
715724 private async persistOtomiSettings (
@@ -730,11 +739,12 @@ export default class OtomiStack {
730739 remoteHasContent : boolean
731740 filePath : string
732741 aplObject : AplObject
742+ sealedSecretRecord ?: AplRecord
733743 } ) : Promise < void > {
734- const { repoUrl, branch, password, username, remoteHasContent, filePath, aplObject } = params
744+ const { repoUrl, branch, password, username, remoteHasContent, filePath, aplObject, sealedSecretRecord } = params
735745 const rootStack = await getSessionStack ( )
736746 try {
737- await this . git . commitAndEncrypt ( this . editor ! )
747+ await this . git . commit ( this . editor ! )
738748 if ( ! remoteHasContent ) {
739749 // Remote is empty: push so the new remote has the config pointing to itself
740750 await this . git . pushToNewRemote ( repoUrl , branch , password , username )
@@ -743,6 +753,9 @@ export default class OtomiStack {
743753 await this . git . pushWithRetry ( )
744754 await rootStack . git . git . pull ( )
745755 rootStack . fileStore . set ( filePath , aplObject )
756+ if ( sealedSecretRecord ) {
757+ rootStack . fileStore . set ( sealedSecretRecord . filePath , sealedSecretRecord . content )
758+ }
746759 debug ( `Updated root stack values with ${ this . sessionId } migration changes` )
747760 } catch ( e ) {
748761 e . message = getSanitizedErrorMessage ( e )
0 commit comments