Closed drshrey closed 5 years ago
I want to see the result of an export with a "file" type env var. Also, a confirmation toast would be very useful here letting user know if there were any issues importing. Imagine you are using this feature to do a bulk update on exiting variables and some sort of issue occurrs.
@aballman I created an issue for showing all API errors that come up here - https://github.com/codeamp/panel/issues/321. Doing that would solve the issue of import/export notifications as well as any future components that would receive API errors.
Since that's a separate concern, I was planning on creating a different PR for it rather than incorporating it here.
What're your thoughts on this approach?
@aballman this is what a file type env var looks like when exported:
- key: HELLO_THERE_3
value: |-
alksmdlkasmdlkasmdlkasmdklamsldkmaslmdklasmdsamldkasmdklsalkdmaklsmdlkasmdlkamslkdm
askdjnaskjdnkajsnd
isSecret: false
type: file
@aballman this is what a file type env var looks like when exported:
- key: HELLO_THERE_3 value: |- alksmdlkasmdlkasmdlkasmdklamsldkmaslmdklasmdsamldkasmdklsalkdmaklsmdlkasmdlkamslkdm askdjnaskjdnkajsnd isSecret: false type: file
What if the file is a YAML file itself? I'm also more interested in seeing how linebreaks are handled. Can you use a sample conf file form something to illustrate this?
@aballman I created an issue for showing all API errors that come up here - #321. Doing that would solve the issue of import/export notifications as well as any future components that would receive API errors.
Since that's a separate concern, I was planning on creating a different PR for it rather than incorporating it here.
What're your thoughts on this approach?
I think you should do both. Present a result to user via snackbar and also leave an issue for other areas missing error handling.
Added circuit.yml from the circuit repo as a file env var and this is the exported value:
- key: HELLO_THERE_5
value: "---\nredis:\n username:\n password:\n server: \"redis:6379\"\n database:
\"0\"\n pool: \"30\"\n process: \"1\"\nplugins:\n codeamp:\n workers: 5\n
\ oidc_uri: http://localhost:5556/dex\n oidc_client_id: example-app\n postgres:\n
\ host: \"postgres\"\n port: \"5432\"\n user: \"postgres\"\n dbname:
\"codeamp\"\n sslmode: \"disable\"\n password: \"\"\n service_address:
\":3011\"\n gitsync:\n workers: 1\n workdir: \"/tmp/gitsync\" \n heartbeat:\n
\ workers: 0\n kubernetes:\n workers: 5 \n githubstatus:\n workers:
1\n route53:\n workers: 5\n slack:\n workers: 1\n dockerbuilder:\n workers:
1\n registry_host: \"docker.io\"\n registry_org: \"checkr\"\n registry_username:
\"\"\n registry_password: \"\"\n registry_user_email: \"\"\n docker_host:
\"unix:///var/run/docker.sock\"\n workdir: \"/tmp/docker_build\" \n"
isSecret: true
type: file
Added circuit.yml from the circuit repo as a file env var and this is the exported value:
- key: HELLO_THERE_5 value: "---\nredis:\n username:\n password:\n server: \"redis:6379\"\n database: \"0\"\n pool: \"30\"\n process: \"1\"\nplugins:\n codeamp:\n workers: 5\n \ oidc_uri: http://localhost:5556/dex\n oidc_client_id: example-app\n postgres:\n \ host: \"postgres\"\n port: \"5432\"\n user: \"postgres\"\n dbname: \"codeamp\"\n sslmode: \"disable\"\n password: \"\"\n service_address: \":3011\"\n gitsync:\n workers: 1\n workdir: \"/tmp/gitsync\" \n heartbeat:\n \ workers: 0\n kubernetes:\n workers: 5 \n githubstatus:\n workers: 1\n route53:\n workers: 5\n slack:\n workers: 1\n dockerbuilder:\n workers: 1\n registry_host: \"docker.io\"\n registry_org: \"checkr\"\n registry_username: \"\"\n registry_password: \"\"\n registry_user_email: \"\"\n docker_host: \"unix:///var/run/docker.sock\"\n workdir: \"/tmp/docker_build\" \n" isSecret: true type: file
Is there any way we could preserve linebreaks in this without printing a "\n" ? This is super messy in its present format
@aballman So I've integrated js-yaml into the export function (load and dump) and we now have an exported file output like this:
- key: HELLO_THERE_15
value: |
---
redis:
username:
password:
server: "redis:6379"
database: "0"
pool: "30"
process: "1"
plugins:
codeamp:
workers: 1
oidc_uri: http://localhost:5556/dex
oidc_client_id: example-app
postgres:
host: "postgres"
port: "5432"
user: "postgres"
dbname: "codeamp"
sslmode: "disable"
password: ""
service_address: ":3011"
gitsync:
workers: 1
workdir: "/tmp/gitsync"
heartbeat:
workers: 0
kubernetes:
workers: 1
githubstatus:
workers: 1
route53:
workers: 1
slack:
workers: 1
dockerbuilder:
workers: 1
registry_host: "docker.io"
registry_org: "checkr"
registry_username: ""
registry_password: ""
registry_user_email: ""
docker_host: "unix:///var/run/docker.sock"
workdir: "/tmp/docker_build"
isSecret: false
type: file
Add functionality to import and export project secrets through YAML files. This will drastically speed up configuration times when initializing Secrets for a project.
Preview: https://www.dropbox.com/s/y30z1q5vl4r3u3e/import-export-secrets.mov?dl=0