feat: set env vars on deploy via --env#165
Open
pat-s wants to merge 9 commits into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #77
Summary
Adds
ricochet deploy --envso users can set environment variables / secrets on a content item's initial deployment. Variables are RSA-encrypted client-side against the server's public key and attached to the deploy upload; the server decrypts and re-encrypts them with AES-256 at rest.--env KEY=VALUEsets a variable directly;--env KEY(no value) resolves it from.env, then.Renviron, then the calling environment, erroring if unresolved. Repeatable (-e)..env/.Renvironfiles are never auto-loaded (avoids unintentionally publishing arbitrary definitions).How it works
src/env_vars.rs— resolves--enventries + parses.env/.Renviron(KEY=VALUE, comments, quotes,exportprefix).src/crypto.rs— fetches/parses the server's PKCS#1 PEM public key and RSA-OAEP/SHA-256 encrypts each variable name and value (base64-standard), matching the server's decryption exactly.RicochetClient::get_public_key()hitsGET /api/v0/public-key, called only when--envis provided.deploy()attaches the encrypted vars as the multipartenv_varsfield.Notes
--envsurfaces the server's clear error; change variables later via the web UI.rsa(OAEP/SHA-256, withgetrandom+sha2features) andbase64.--env, and the first-deploy error path.