summaryrefslogtreecommitdiff
path: root/config.py
blob: 88b07e7fa169984062d3d0a6db49bb023b06da06 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import importlib, sys

# default config file, copy the contents into local_config.py and modify
if __name__ == "local_config":
    config = importlib.reload(sys.modules["config"]).config
else:

    class config:  # dummy, so the local config can simply be a copy of this template
        ...


class config(config):
    class self:
        name = "KleaBot"
        source = "http://git.hollyhock.internal/u/klea/archiveteam"
        gitdir = "./"

    class mediawikiAuth:
        import os
        login = False
        username = ""
        password = ""
        if 'ATWIKIBOT_USERNAME' in os.environ and 'ATWIKIBOT_PASSWORD' in os.environ:
            login = True
            username = os.environ['ATWIKIBOT_USERNAME']
            password = os.environ['ATWIKIBOT_PASSWORD']

    class admin:
        ...

    class cmd:
        ...

# you can remove the following lines if you're editing local_config.py
if __name__ == "config":
    try:
        config = importlib.reload(sys.modules["local_config"]).config
    except ModuleNotFoundError:
        ...
        #print("\x1b[31m!!! you should probably set up local config !!!\x1b[0m")
    except KeyError:
        try:
            from local_config import config
        except ModuleNotFoundError:
            ...
            #print("\x1b[31m!!! you should probably set up local config !!!\x1b[0m")