Skip to content
This repository was archived by the owner on Sep 12, 2018. It is now read-only.

Commit 884b418

Browse files
author
Mangled Deutz
committed
Type from environment properly (like Config)
Docker-DCO-1.1-Signed-off-by: Mangled Deutz <[email protected]> (github: dmp42)
1 parent 5ec1416 commit 884b418

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

docker_registry/server/env.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
# -*- coding: utf-8 -*-
22

33
import os
4+
import yaml
45

56
__all__ = ['source']
67

78
_DEFAULT = {
8-
'REGISTRY_PORT': 5000,
9+
'REGISTRY_PORT': '5000',
910
'REGISTRY_HOST': '0.0.0.0',
1011
'SETTINGS_FLAVOR': 'dev',
11-
'GUNICORN_WORKERS': 4,
12-
'GUNICORN_GRACEFUL_TIMEOUT': 3600,
13-
'GUNICORN_SILENT_TIMEOUT': 3600
12+
'GUNICORN_WORKERS': '4',
13+
'GUNICORN_GRACEFUL_TIMEOUT': '3600',
14+
'GUNICORN_SILENT_TIMEOUT': '3600'
1415
}
1516

1617

17-
def source(key, override=None):
18-
return os.environ.get(key, _DEFAULT[key] if key in _DEFAULT else override)
18+
def source(key, override='None'):
19+
# Using yaml gives us proper typage
20+
return yaml.load(
21+
os.environ.get(key, _DEFAULT[key] if key in _DEFAULT else override))

0 commit comments

Comments
 (0)