docs/rofl/features: Document public variables#2487
Conversation
✅ Deploy Preview for oasisprotocol-oasis-sdk ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2487 +/- ##
==========================================
- Coverage 51.24% 51.23% -0.02%
==========================================
Files 237 237
Lines 17294 17294
==========================================
- Hits 8862 8860 -2
- Misses 8372 8374 +2
Partials 60 60 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
0e7a937 to
38c6647
Compare
| environment: | ||
| - API_URL=${API_URL} | ||
| ``` | ||
|
|
There was a problem hiding this comment.
Maybe add some alternatives such as Compose file and .env, for example:
| ## Public variables vs Compose file and `.env` | |
| Apart from public variables ROFL developers can expose environment variables directly in the Compose file as literals. For example: | |
| ```yaml | |
| services: | |
| test: | |
| image: docker.io/library/alpine:3.21.2@sha256:f3240395711384fc3c07daa46cbc8d73aa5ba25ad1deb97424992760f8cb2b94 | |
| command: echo "API URL is $API_URL" | |
| environment: | |
| - API_URL="https://api.example.com/v1" | |
| ``` | |
| The downside of this approach is that each time the literal is updated, the hash of the Compose file changes and thus the ROFL needs to be rebuilt and redeployed. | |
| Another approach is storing public environment variables inside the `.env` file. In this case, users can investigate the container image to examine environment variables. This approach comes handy during development, because you can feed the same `.env` file locally and then inside production ROFL. However, similarly to the approach above, the container hash will change each time you change the `.env` file and consequently the container hash changes in your Compose file, which requires you to rebuild and redeploy ROFL. |
There was a problem hiding this comment.
Does this add value?
- Compose file literals probably one can infer from the existing compose syntax.
- Alternative doesn't have much to do with public variables, as one can bake arbitrary stuff into docker image, doesn't have to be .env, can be
config.tomlalso.
This approach comes handy during development, because you can feed the same
.envfile locally and then inside production ROFL.
you can do the same by adding explicit --env-file flag to compose command.
38c6647 to
a10f69e
Compare
a10f69e to
57f31ba
Compare
There was a problem hiding this comment.
Maybe rename to public_variables.md for consistency? The chapters here are named more SEO-like and not what CLI names the commands.
Closes #2486.
Followed the style of secrets 1:1 (instructed codex to generate text for me and reviewed myself).
E.g. see https://explorer.oasis.io/testnet/sapphire/tx/0c788cbf3be706f6641e6d475d5af126c482e05e6c7dcd5e05e0930364a03db7 for real deployment.