def setup_server(): """Create and set up an internal REST server for admin operations.""" global server, authz_key authz_key = fake_authz_key_file() cfg = Config(authkey=authz_key.name) delattr(cfg.views, 'ui') cfg.main.index = 'data' cfg.main.silent = True cfg.views.data.object = "SiteDB.Admin.AdminServer" cfg.views.data.db = "SiteDB.Admin.AUTH" server = RESTMain(cfg, os.getcwd()) server.validate_config() server.setup_server() server.install_application() cherrypy.config.update({'server.socket_port': 8888}) cherrypy.config.update({'server.socket_host': '127.0.0.1'}) cherrypy.config.update({'request.show_tracebacks': True}) cherrypy.config.update({'environment': 'test_suite'}) cherrypy.config.update({'log.screen': 'True'})
from SiteDB.Config import Config import os, socket os.environ["NLS_LANG"] = ".AL32UTF8" THREADS = 50 HOST = socket.gethostname().lower() KEY_FILE = "%s/auth/wmcore-auth/header-auth-key" % __file__.rsplit('/', 3)[0] config = Config(nthreads = THREADS, authkey = KEY_FILE) if HOST.startswith("vocms0127"): config.views.data.ldapsync = True config.views.data.ldsyncto = "dev" config.views.data.ldsynctime = 300 config.views.data.rebusfetch = True config.views.data.rebusfetchto = "dev" config.views.data.rebusfetchtime = 10800 if HOST.startswith("vocms0161"): config.views.data.ldapsync = True config.views.data.ldsyncto = "prod" config.views.data.ldsynctime = 300 config.views.data.rebusfetch = True config.views.data.rebusfetchto = "prod" config.views.data.rebusfetchtime = 10800 # config.main.tools.cms_auth.policy = 'dangerously_insecure' # config.main.server.environment = 'staging' # config.main.server.socket_host = '127.0.0.1' # config.main.profile = True