winglang / wing

A programming language for the cloud ☁️ A unified programming model, combining infrastructure and runtime code into one language ⚡
https://winglang.io
Other
4.76k stars 187 forks source link

`wing secrets` retain existing secrets values #6581

Open hasanaburayyan opened 1 month ago

hasanaburayyan commented 1 month ago

Use Case

Running wing secrets now does not require entering secret values that have already been provided

Given this code:

bring cloud;

let s = new cloud.Secret(name: "secret1") as "s1";
let s2 = new cloud.Secret(name: "secret2") as "s2";
let s3 = new cloud.Secret(name: "secret3") as "s3";

The first time wing secrets is ran the experience remained the same:

❯ wing secrets main.w 
3 secret(s) found

? Enter the secret value for secret1: [hidden]
? Enter the secret value for secret2: [hidden]
? Enter the secret value for secret3: [hidden]

On a subsequent run where existing values were found the experience is now:

❯ wing secrets main.w 
3 secret(s) found

? Enter the secret value for secret1 (existing value found press enter to keep): [hidden]
? Enter the secret value for secret2 (existing value found press enter to keep): [hidden]
? Enter the secret value for secret3 (existing value found press enter to keep): [hidden]

Proposed Solution

No response

Implementation Notes

This will be a little complicated for targets other than sim since it will require using the platform to lookup existing values

Component

No response

Community Notes

eladb commented 1 month ago

From a UX perspective maybe we can still show all the secrets but allow the user to simply press ENTER to keep the currently stored secret.

This way we don't need an additional option for the "update" use case.

Otherwise, we will need some way to ask to re-store a secret.