Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding config variables via run-app-docker-opts #5

Open
stuartpb opened this issue Aug 25, 2014 · 7 comments
Open

Adding config variables via run-app-docker-opts #5

stuartpb opened this issue Aug 25, 2014 · 7 comments

Comments

@stuartpb
Copy link
Member

This was touched on in #4: Heroku adds config variables "before" executing the contents of .profile.d.

This would remove most of the point of the release step (which still needs to exist because of stuff like the way plushu-addons defines linked container variables), and would replace the app-env hook (unless plushu-release-env were to defer to --env options, which would break the aforementioned plushu-addons).

@stuartpb
Copy link
Member Author

stuartpb commented Apr 2, 2015

Considering how app-env works (ie. for addons it expands the Docker link environment variables), this would need a little more thought (so "app-env" would need to be split into "app-env" and "app-profile", with a plugin that could dump "app-env" into "app-profile" as an alternative to one that adds "app-env" as "--env" options).

@stuartpb
Copy link
Member Author

stuartpb commented Apr 2, 2015

So plushu-release-env would become plushu-release-app-profile and would have to be used in conjunction with either plushu-app-env-in-profile or plushu-app-env-docker-opts.

@stuartpb
Copy link
Member Author

stuartpb commented Apr 6, 2015

Actually, I think I'll deprecate the app-env altogether in favor of plushu-app-env-docker-opts, which will read the app's environment from the config directory rather than a hook (#4).

So basically, everything that isn't config will change to use the app-profile hook, plushu-release-env will be renamed to plushu-release-app-profile, and there will be a new plugin (plushu-app-env-docker-opts) that will apply config when running local apps.

Actually, I'll keep the app-env hook between config and app-env-docker-opts, just with the understanding that anything that isn't providing basic key-value arguments should be using app-profile instead. (The meta-variable plugin would then still use app-env.)

@stuartpb
Copy link
Member Author

stuartpb commented Apr 6, 2015

Now, the question is, is there a simple way to interpolate -e options between incoming variables without deserializing and re-serializing? I'm considering making it a codified fact that every line of app-env is an environment variable, which would make it as simple as inserting "-e" at the beginning of every line (which is trivial).

@stuartpb
Copy link
Member Author

stuartpb commented Apr 7, 2015

Except, nuts, xargs doesn't deserialize $'bash'-type strings, which is what printf %q outputs when its input has newlines. So changing app-env to not involve shell interpolation means there needs to be a better mechanism for serializing these - I'm afraid that'll be printf "'"; sed "s/'/'\\''/g" "$FILENAME"; printf "'". And, unless the signature of app-env changes, that'll have to happen again for the conversion to run-app-docker-opts.

So... I'm thinking there might be a new "sentinel value" argument to app-env signaling that environment var pairings should be prefixed with "-e ".

@stuartpb
Copy link
Member Author

stuartpb commented Apr 7, 2015

Alternately, app-env could convert to backslash-escaped-whitespace read syntax, which is compatible with xargs, follows existing hook precedent, and is fairly simple to process with sed iirc

while read pair; do
  printf '-e '
  sed 's/\s/\\\0/g' <<<"$pair"
  printf '\n'
done

Or maybe the sed+herestring part could even be done in-shell, or in awk (entirely in awk?).

@stuartpb
Copy link
Member Author

stuartpb commented Apr 8, 2015

Anyway, I guess the future of app-env kind of depends on #4 as well as this, since the current serialization format is very profile-specific.

Either way, what needs to happen now is #6.

stuartpb added a commit that referenced this issue Apr 10, 2015
stuartpb added a commit to plushu/plushu-meta-app-env that referenced this issue Apr 10, 2015
See plushu/plushu-config#5: until app-env can be re-evaluated,
this plugin will be providing its variables with profile code
(the same way as it already does, but at the profile-specific
name).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant