open-balena-api
open-balena-api copied to clipboard
Replace RESIN_ env vars with BALENA_
Title says it all. Not sure if replacing all hardcoded instances will have a negative effect on the current dashboard without some kind of migration?
[klutchell] This issue has attached support thread https://jel.ly.fish/f15cce18-c260-48e1-ae37-193b93a0f73c
You probably mean config vars (ie. not env vars) because env vars can be anything except starting with those prefixes.
We ultimately want to get rid of the prefixes -- they were (mostly) a work around to signifying special env vars before we added the "config vars" resource/concept, as both user-defined and special vars were stored as env vars. There's #34 for quite a while which is blocked for a few reasons.
Here are the ways these prefixes are significant:
- devices: older devices use the
RESIN_prefix, newer useBALENA_. We would need to be able to differentiate which one to use on the state endpoint based on the device's reported Supervisor version. The bummer is we don't necessarily know the version early enough. I think that Supervisors that acceptBALENA_prefixed config vars also accept and internally transformRESIN_prefixed ones (we'd have to double-check as I'm not sure) which may simplify things. - OData API: the actual model resources can be accessed via the OData API. Both prefixes are magical now and settling on one or the other (or neither, like the PR does) means we'd have to somehow translate them appropriately for the given API version in balena-api during reads and writes. open-balena-api on the other hand does not support translations at all yet, but this can be achieved (for the most part) by also bumping the exposed OData API version.
- Clients: I'm putting this separately even though it is closely related to the point above. The fact that a client might POST a
RESIN_-prefixed config var and read back aBALENA_-prefixed value may catch some clients off guard. There's no sensible way to tackle this that I can think of, except bite the bullet and hope for the best.
All in all, this is totally worth raising for a brainstorm if you feel like it.
You probably mean config vars (ie. not env vars)
Yup, thank you!
I think that Supervisors that accept BALENA_ prefixed config vars also accept and internally transform RESIN_ prefixed ones (we'd have to double-check as I'm not sure) which may simplify things.
This is correct, I can confirm.