Skip to content

Commit

Permalink
Merge pull request #59 from Dstack-TEE/fix-app-id-on-reset
Browse files Browse the repository at this point in the history
teepod: Fix wrong app-id during reset secret
  • Loading branch information
kvinwang authored Dec 16, 2024
2 parents ec4eeef + cfd9bf1 commit ef6ee07
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions teepod/src/console.html
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,13 @@ <h3>Update VM Config</h3>
Remove
</button>
</div>
<button type="button" class="action-btn" @click="addEncryptedEnv">Add</button>
<div style="display: flex; gap: 10px;">
<button type="button" class="action-btn" @click="addEncryptedEnv">Add</button>
<input type="file" ref="envFile" @change="loadEnvFile" style="display: none"
accept=".env,.txt">
<button type="button" class="action-btn" @click="$refs.envFile.click()">Load from
file</button>
</div>
</div>

<div class="vm-actions">
Expand Down Expand Up @@ -1000,9 +1006,11 @@ <h3>Derive VM</h3>
return Array.from(result).map(b => b.toString(16).padStart(2, '0')).join('');
};

const makeEncryptedEnv = async () => {
const makeEncryptedEnv = async (appId) => {
if ((!vmForm.value.features.kms) || vmForm.value.encrypted_envs.length === 0) return '';
const appId = await appIdOf(vmForm.value.compose_file);
if (!appId) {
appId = await appIdOf(vmForm.value.compose_file);
}
const response = await rpcCall('GetAppEnvEncryptPubKey', {
app_id: appId
});
Expand Down Expand Up @@ -1154,7 +1162,7 @@ <h3>Derive VM</h3>
}

if (upgradeDialog.value.resetSecrets) {
body.encrypted_env = await makeEncryptedEnv();
body.encrypted_env = await makeEncryptedEnv(upgradeDialog.value.vm.app_id);
}

const response = await rpcCall('UpgradeApp', body);
Expand Down

0 comments on commit ef6ee07

Please sign in to comment.