-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding capabilities for environment variables
- Loading branch information
1 parent
0c7355f
commit e6cc2fe
Showing
7 changed files
with
64 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
==== | ||
Envs | ||
==== | ||
|
||
The envs section can be used to set environment variables within the | ||
Uranium sandbox. | ||
|
||
envs should be a dictionary of <environment variable, value> pairs. These | ||
Will be set as environment variables for the execution of both the Uranium run, | ||
and also for any entry-points generated as well. | ||
|
||
.. code-block:: yaml | ||
envs: | ||
AUTH_URL: 'http://example.com/auth' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ Contents: | |
tutorial | ||
config | ||
eggs | ||
envs | ||
indexes | ||
inheritance | ||
versions | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
from .utils import assert_condition, dict_types | ||
|
||
KEY = "envs" | ||
|
||
|
||
class Envs(object): | ||
|
||
def _initialize(self): | ||
self[KEY] = self.get(KEY, {}) | ||
|
||
def _validate(self, warnings, errors): | ||
assert_condition( | ||
errors, isinstance(self[KEY], dict_types), | ||
"envs must be a dict! found {0} instead.".format(type(self[KEY])) | ||
) | ||
|
||
@property | ||
def envs(self): | ||
return self[KEY] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from uranium.config import Config | ||
from uranium.tests.utils import get_valid_config | ||
from nose.tools import eq_ | ||
|
||
|
||
class TestEnvs(object): | ||
|
||
def setUp(self): | ||
config = get_valid_config() | ||
self.config_dict = config | ||
self.config = Config(config) | ||
|
||
def test_non_dict(self): | ||
self.config['envs'] = [ | ||
'ENV_VAR = "foo"' | ||
] | ||
warnings, errors = self.config.validate() | ||
eq_(len(errors), 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters