Commits

heya...@fe34127c-c842-0410-aa83-9fc675b9a81c  committed 459733b

make it easier for alternative services (non-orbited) to setup cometsession or proxy instances

  • Participants
  • Parent commits 136742a
  • Branches 0.7

Comments (0)

Files changed (3)

File daemon/orbited/config.py

     map.update(kwargs)
     return True
 
-def setup(argv):
+defaultPaths = [
+    os.path.join('/', 'etc', 'orbited.cfg'),
+    os.path.join('/', 'Program Files', 'Orbited', 'etc', 'orbited.cfg'),
+    'orbited.cfg',
+]
+
+def setup(argv, paths=defaultPaths):
     parser = OptionParser()
     parser.add_option(
         "--config",
 
     if not options.config:
         # no config file specified, try to search it.
-        paths = [
-            os.path.join('/', 'etc', 'orbited.cfg'),
-            os.path.join('/', 'Program Files', 'Orbited', 'etc', 'orbited.cfg'),
-            'orbited.cfg',
-        ]
         for path in paths:
             if os.path.exists(path):
                 options.config = path

File daemon/orbited/start.py

             reactor.listenWith(port_class, factory=factory_class(), resource=root, childName=child_path)
             logger.info('%s protocol active' % config_key)
 
-def _setup_static(root):
+def _setup_static(root, config):
     from twisted.web import static
-    for key, val in config.map['[static]'].items():
+    for key, val in config['[static]'].items():
         if key == 'INDEX':
             key = ''
         if root.getStaticEntity(key):
     site = server.Site(root)
 
     _setup_protocols(root)
-    _setup_static(root)
+    _setup_static(root, config.map)
+    start_listening(site, config.map, logger)
+    reactor.run()
 
-    for addr in config.map['[listen]']:
+def start_listening(site, config, logger):
+    from twisted.internet import reactor
+    for addr in config['[listen]']:
         url = urlparse.urlparse(addr)
         hostname = url.hostname or ''
         if url.scheme == 'http':
             reactor.listenTCP(url.port, site, interface=hostname)
         elif url.scheme == 'https':
             from twisted.internet import ssl
-            crt = config.map['[ssl]']['crt']
-            key = config.map['[ssl]']['key']
+            crt = config['[ssl]']['crt']
+            key = config['[ssl]']['key']
             try:
                 ssl_context = ssl.DefaultOpenSSLContextFactory(key, crt)
             except ImportError:
             logger.error("Invalid Listen URI: %s" % addr)
             sys.exit(-1)
 
-    reactor.run()
 
 if __name__ == "__main__":
     main()

File daemon/setup.py

 
 setup(
     name='orbited',
-    version='0.6.0',
+    version='0.7.0',
     author='Michael Carter',
     author_email='CarterMichael@gmail.com',
     url='http://www.orbited.org',
     ''',
     
     classifiers = [
-        'Development Status :: 3 - Alpha',
+        'Development Status :: 4 - Beta',
         'Environment :: Console',
         'Intended Audience :: Developers',
         'License :: OSI Approved :: MIT License',