Skip to content

Commit e3d8ef5

Browse files
committed
Environment keys can contain empty values
Environment keys that contain no value, get populated with values taken from the environment not from the build phase but from running the command `up`. Signed-off-by: Mazz Mosley <mazz@houseofmnowster.com>
1 parent ff83c45 commit e3d8ef5

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

compose/config/fields_schema.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"type": "object",
4242
"patternProperties": {
4343
"^[^-]+$": {
44-
"type": ["string", "number", "boolean"],
44+
"type": ["string", "number", "boolean", "null"],
4545
"format": "environment"
4646
}
4747
},

tests/unit/config/config_test.py

+17
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,23 @@ def test_invalid_interpolation(self):
414414
self.assertIn('in service "web"', cm.exception.msg)
415415
self.assertIn('"${"', cm.exception.msg)
416416

417+
def test_empty_environment_key_allowed(self):
418+
service_dict = config.load(
419+
build_config_details(
420+
{
421+
'web': {
422+
'build': '.',
423+
'environment': {
424+
'POSTGRES_PASSWORD': ''
425+
},
426+
},
427+
},
428+
'.',
429+
None,
430+
)
431+
)[0]
432+
self.assertEquals(service_dict['environment']['POSTGRES_PASSWORD'], '')
433+
417434

418435
class VolumeConfigTest(unittest.TestCase):
419436
def test_no_binding(self):

0 commit comments

Comments
 (0)