riboseinc / riffol

Initialization system in Rust
26 stars 4 forks source link

Supports per application environment variables. Fixes #21 #28

Closed drystone closed 6 years ago

ronaldtse commented 6 years ago

@drystone I believe the environment variables would be better set in this way rather than in an array?

application "xxx" {
  env {
    FOOBAR = "foo"
    BARFOO = "bar"
  }
}
drystone commented 6 years ago

Is there a compelling reason to use a dictionary?

To pass a variable (NEREON_FILESET) through from riffol's environment the current (array) syntax is

application "xxx" {
    env = [
        NEREON_FILESET
        LD_LIBRARY_PATH=/usr/local/lib
    ]
}

Using a dictionary would require a value for NEREON_FILESET.

ronaldtse commented 6 years ago

Environment variables require unique keys, so a dictionary would be most suitable?

drystone commented 6 years ago

Is it worth the additional syntax to pass the environment variable through from riffol?

env  = {
    NEREON_FILESET = "$NEREON_FILESET"
}

In which case should we allow arbitrary substitution, not just at the beginning of the string?

env = {
    PATH = /usr/local/bin:$PATH
}

and escaping?

CURRENCY="\$"

?

ronaldtse commented 6 years ago

This is a great idea -- the only uncertainty to me is about interpolation, whether this:

    PATH = /usr/local/bin:$PATH

should look like this:

    PATH = "/usr/local/bin:${PATH}"

or something like:

    PATH = "/usr/local/bin:${env.PATH}"