Commits

Eric Larson  committed 90acf6a

Convert the port to an int in the server config

  • Participants
  • Parent commits 319f7bf

Comments (0)

Files changed (2)

File alamode/config/__init__.py

         'port': 'server.socket_port',
     }
 
+    def __init__(self, **kw):
+        if 'port' in kw:
+            kw['port'] = int(kw['port'])
+        DictConfig.__init__(self, **kw)
+
     def __call__(self):
         config = self.data.copy()
         for shortname, cpname in self.shortnames_map.items():

File tests/unit/test_config.py

         assert conf['port'] == 8080
         assert conf() == {'server.socket_host': 'localhost',
                           'server.socket_port': 8080}
+
+    def test_port_is_converted_to_int(self):
+        conf = ServerConfig(port='8080')
+        assert conf['port'] == 8080