def __init__(self, enabled_plugins=['SQLite'], default_config={}): assert enabled_plugins is None or isinstance(enabled_plugins, list) self.enabled_plugins = enabled_plugins assert default_config is None or isinstance(default_config, dict) self.default_config = default_config # Call parent constructor RdiffwebApp.__init__(self)
def __init__(self, default_config={}): assert default_config is None or isinstance(default_config, dict) self.default_config = default_config # database in memory self.database_dir = tempfile.mkdtemp(prefix='rdiffweb_tests_db_') default_config['SQLiteDBFile'] = os.path.join(self.database_dir, 'rdiffweb.tmp.db') # Call parent constructor RdiffwebApp.__init__(self, cfg=default_config)
def load_config(self, configfile=None): RdiffwebApp.load_config(self, None) # Enabled given plugins for plugin_name in self.enabled_plugins: self.cfg.set_config('%sEnabled' % plugin_name, 'True') # database in memory if 'SQLite' in self.enabled_plugins: self.cfg.set_config('SQLiteDBFile', '/tmp/rdiffweb.tmp.db') if 'Ldap' in self.enabled_plugins: self.cfg.set_config('LdapUri', '__default__') self.cfg.set_config('LdapBaseDn', 'dc=nodomain') # Set config for key, val in self.default_config.items(): self.cfg.set_config(key, val)
def load_config(self, configfile=None): RdiffwebApp.load_config(self, None) # Enabled given plugins for plugin_name in self.enabled_plugins: self.cfg.set_config('%sEnabled' % plugin_name, 'True') # database in memory if 'SQLite' in self.enabled_plugins: self.database_dir = tempfile.mkdtemp(prefix='rdiffweb_tests_db_') self.cfg.set_config('SQLiteDBFile', os.path.join(self.database_dir, 'rdiffweb.tmp.db')) if 'Ldap' in self.enabled_plugins: self.cfg.set_config('LdapUri', '__default__') self.cfg.set_config('LdapBaseDn', 'dc=nodomain') # Set config for key, val in list(self.default_config.items()): self.cfg.set_config(key, val)
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. ''' Created on Mar. 3, 2019 @author: Patrik Dufresne <*****@*****.**> ''' from __future__ import unicode_literals from rdiffweb.core.config import read_config from rdiffweb.rdw_app import RdiffwebApp import cherrypy import os if __name__.startswith("uwsgi"): # Read config file configfile = os.environ.get('RDIFFWEB_CONFIG', '/etc/rdiffweb/rdw.conf') cfg = read_config(configfile) # Create application cherrypy.config.update({'engine.autoreload.on': False}) cherrypy.server.unsubscribe() cherrypy.engine.start() wsgiapp = cherrypy.tree.mount(RdiffwebApp(cfg))