azukiapp / azk

azk is a lightweight open source development environment orchestration tool. Instantly & safely run any environment on your local machine.
http://azk.io
Apache License 2.0
899 stars 63 forks source link

Environment Variables expansion #650

Closed nuxlli closed 8 years ago

nuxlli commented 8 years ago

Due to a logic issue, the command property of the web system in the excerpt below didn't work. In the other hand, the command of the worker system was working normally.

systems({
  web: {
    image: { docker: "azukiapp/ruby" },
    command: ["bundle", "exec", "rails", "-p", "$HTTP_PORT"],
  },
  worker: {
    image: { docker: "azukiapp/ruby" },
    command: "bundle exec rails -p $HTTP_PORT",
  },
});

The reason for it is that, in the case of the system worker, the command was sent to Docker as /bin/sh -c "[command]" and, therefore, the HTTP_PORT var was properly expanded.

In the case of the web system, the bundle command was executed directly, without variables expansion by a subshell (/bin/sh).

To solve this issue, two major changes was done:

Finally, the docs has a new session with a detailed explanation of how env vars are processed.

saitodisse commented 8 years ago

This looks very nice.