Ejemplo n.º 1
0
def get_web_config(_, start_response):
    status = "200 OK"
    headers = [("Content-type", "application/json; charset=UTF-8"),
               ("Access-Control-Allow-Origin", "*")]
    start_response(status, headers)
    db_path = os.path.abspath(os.path.dirname(__file__)).replace("scripts", "")
    config = WebConfig(db_path)
    config.time_series_status = time_series_tester(config)
    db_locals = MakeDBConfig(os.path.join(db_path, "data/db.locals.py"))
    config.data["available_metadata"] = db_locals.metadata_fields
    yield config.to_json().encode("utf8")
Ejemplo n.º 2
0
 def write_db_config(self):
     """ Write local variables used by libphilo"""
     filename = self.destination + "/db.locals.py"
     metadata = [i for i in self.metadata_fields if i not in self.metadata_fields_not_found]
     db_values = {
         "metadata_fields": metadata,
         "metadata_hierarchy": self.metadata_hierarchy,
         "metadata_types": self.metadata_types,
         "normalized_fields": self.normalized_fields,
         "debug": self.debug,
     }
     db_values["token_regex"] = self.token_regex
     db_values["default_object_level"] = self.default_object_level
     db_config = MakeDBConfig(filename, **db_values)
     print(db_config, file=open(filename, "w"))
     print("wrote database info to %s." % (filename))