docker/config.py
changeset 142 640fb0f13022
equal deleted inserted replaced
141:26faef513d90 142:640fb0f13022
       
     1 from rdflib import URIRef, RDF, RDFS, Literal
       
     2 from rdflib.namespace import SKOS
       
     3 from kombu import Queue
       
     4 from environs import Env
       
     5 
       
     6 env = Env()
       
     7 env.read_env()  # read .env file, if it exists
       
     8 # Debug and running settings
       
     9 
       
    10 HOST = "0.0.0.0"
       
    11 DEBUG = env.bool("DEBUG", True)
       
    12 
       
    13 SERVER_NAME = "catedit.iri-research.org"
       
    14 BASE_URL = env.str("BASE_URL", "https://catedit.iri-research.org")
       
    15 
       
    16 # WTForms settings
       
    17 
       
    18 SECRET_KEY = env.str("SECRET_KEY")
       
    19 
       
    20 LOGGING_CONFIG = {
       
    21     "IS_LOGGING": True,
       
    22     "LOGGING_LEVEL": "DEBUG",
       
    23     "LOG_FILE_PATH": "-",
       
    24 }
       
    25 
       
    26 CACHE_CONFIG = {
       
    27     "CACHE_TYPE": "memcached",
       
    28     "CACHE_KEY_PREFIX": "ctdt",
       
    29     "CACHE_MEMCACHED_SERVERS" : (env.str('MEMCACHED_URL'),),
       
    30 }
       
    31 
       
    32 # Github repository config
       
    33 PERSISTENCE_CONFIG = {
       
    34     "METHOD" : "PersistenceToGithub",
       
    35     "REPOSITORY_LIST" : [
       
    36         "catedit-dev-testing",
       
    37         "mons-categories-prototype",
       
    38         "habitabilite-prototype",
       
    39         "collaboration-prototype",
       
    40         "economie-de-la-contribution",
       
    41         "habitabilite-chercheur",
       
    42         "explorunivers-habitabilite",
       
    43         "catedit-testing",
       
    44     ],
       
    45     "REPOSITORY_OWNER" : "catedit-system",
       
    46     "CATEGORIES_PATH" : "categories/",
       
    47     "GITHUB_CLIENT_ID" : env.str("GITHUB_CLIENT_ID"),
       
    48     "GITHUB_CLIENT_SECRET" : env.str("GITHUB_CLIENT_SECRET")
       
    49 }
       
    50 
       
    51 # Property List
       
    52 PROPERTY_LIST = {
       
    53     RDFS.subClassOf.toPython(): {
       
    54         "descriptive_label_fr": "Sous-classe de",
       
    55         "descriptive_label_en": "Subclass of",
       
    56         "object_type": "uriref-category",
       
    57         "usable_in_editor": True,
       
    58         "rdflib_class": RDFS.subClassOf,
       
    59     },
       
    60     RDFS.comment.toPython(): {
       
    61         "descriptive_label_fr": "Commentaire",
       
    62         "descriptive_label_en": "Comment",
       
    63         "object_type": "literal",
       
    64         "usable_in_editor": True,
       
    65         "rdflib_class": RDFS.comment,
       
    66     },
       
    67     RDFS.Resource.toPython(): {
       
    68         "descriptive_label_fr": "Ressource",
       
    69         "descriptive_label_en": "Resource",
       
    70         "object_type": "uriref-link",
       
    71         "usable_in_editor": True,
       
    72         "rdflib_class": RDFS.Resource,
       
    73     },
       
    74     SKOS.related.toPython(): {
       
    75         "descriptive_label_fr": "En relation avec",
       
    76         "descriptive_label_en": "Related to",
       
    77         "object_type": "uriref-category",
       
    78         "usable_in_editor": True,
       
    79         "rdflib_class": SKOS.related,
       
    80     }
       
    81 }
       
    82 
       
    83 
       
    84 CELERY_BROKER_URL = env.str('BROKER_URL')
       
    85 CELERY_RESULT_BACKEND = env.str('RESULT_BROKER_URL')
       
    86 if PERSISTENCE_CONFIG["METHOD"] == "PersistenceToGithub":
       
    87     CELERY_QUEUES = tuple(
       
    88         Queue("repo_"+repository, routing_key="task_for_"+repository) for repository in PERSISTENCE_CONFIG["REPOSITORY_LIST"]
       
    89     )