def load_config(self): default_config_path = os.path.join(serve_path(self.test_paths), "config.default.json") local_config_path = os.path.join(here, "config.json") with open(default_config_path) as f: default_config = json.load(f) with open(local_config_path) as f: data = f.read() local_config = json.loads(data % self.options) #TODO: allow non-default configuration for ssl local_config["external_host"] = self.options.get("external_host", None) local_config["ssl"]["encrypt_after_connect"] = self.options.get("encrypt_after_connect", False) config = serve.merge_json(default_config, local_config) config["doc_root"] = serve_path(self.test_paths) if not self.ssl_env.ssl_enabled: config["ports"]["https"] = [None] host = self.options.get("certificate_domain", config["host"]) hosts = [host] hosts.extend("%s.%s" % (item[0], host) for item in serve.get_subdomains(host).values()) key_file, certificate = self.ssl_env.host_cert_path(hosts) config["key_file"] = key_file config["certificate"] = certificate serve.set_computed_defaults(config) return config
def load_config(self): default_config_path = os.path.join(serve_path(self.test_paths), "config.default.json") local_config_path = os.path.join(here, "config.json") with open(default_config_path) as f: default_config = json.load(f) with open(local_config_path) as f: data = f.read() local_config = json.loads(data % self.options) #TODO: allow non-default configuration for ssl local_config["external_host"] = self.options.get("external_host", None) local_config["ssl"]["encrypt_after_connect"] = self.options.get( "encrypt_after_connect", False) config = serve.merge_json(default_config, local_config) config["doc_root"] = serve_path(self.test_paths) if not self.ssl_env.ssl_enabled: config["ports"]["https"] = [None] host = self.options.get("certificate_domain", config["host"]) hosts = [host] hosts.extend("%s.%s" % (item[0], host) for item in serve.get_subdomains(host).values()) key_file, certificate = self.ssl_env.host_cert_path(hosts) config["key_file"] = key_file config["certificate"] = certificate return config
def load_config(self): default_config_path = os.path.join(serve_path(self.test_paths), "config.default.json") local_config = { "ports": { "http": [8000, 8001], "https": [8443], "ws": [8888] }, "check_subdomains": False, "ssl": {} } if "host" in self.options: local_config["host"] = self.options["host"] if "bind_address" in self.options: local_config["bind_address"] = self.options["bind_address"] with open(default_config_path) as f: default_config = json.load(f) local_config["host_ip"] = self.options.get("host_ip", None) local_config["ssl"]["encrypt_after_connect"] = self.options.get( "encrypt_after_connect", False) config = serve.merge_json(default_config, local_config) config["doc_root"] = serve_path(self.test_paths) if not self.ssl_env.ssl_enabled: config["ports"]["https"] = [None] host = self.options.get("certificate_domain", config["host"]) hosts = [host] hosts.extend("%s.%s" % (item[0], host) for item in serve.get_subdomains(host).values()) key_file, certificate = self.ssl_env.host_cert_path(hosts) config["key_file"] = key_file config["certificate"] = certificate serve.set_computed_defaults(config) return config
def load_config(self): default_config_path = os.path.join(serve_path(self.test_paths), "config.default.json") local_config = { "ports": { "http": [8000, 8001], "https": [8443], "ws": [8888] }, "check_subdomains": False, "bind_hostname": self.options["bind_hostname"], "ssl": {} } if "host" in self.options: local_config["host"] = self.options["host"] with open(default_config_path) as f: default_config = json.load(f) #TODO: allow non-default configuration for ssl local_config["external_host"] = self.options.get("external_host", None) local_config["ssl"]["encrypt_after_connect"] = self.options.get("encrypt_after_connect", False) config = serve.merge_json(default_config, local_config) config["doc_root"] = serve_path(self.test_paths) if not self.ssl_env.ssl_enabled: config["ports"]["https"] = [None] host = self.options.get("certificate_domain", config["host"]) hosts = [host] hosts.extend("%s.%s" % (item[0], host) for item in serve.get_subdomains(host).values()) key_file, certificate = self.ssl_env.host_cert_path(hosts) config["key_file"] = key_file config["certificate"] = certificate serve.set_computed_defaults(config) return config