35 'create_parameters': [], |
34 'create_parameters': [], |
36 'prune_parameters': [], |
35 'prune_parameters': [], |
37 } |
36 } |
38 } |
37 } |
39 |
38 |
|
39 # |
|
40 # Branding |
|
41 # |
|
42 |
|
43 appname="borgend" |
|
44 appname_stylised="Borgend" |
|
45 |
|
46 # |
|
47 # Locations |
|
48 # |
|
49 |
|
50 if False: |
|
51 import xdg |
|
52 cfgfile=os.path.join(xdg.XDG_CONFIG_HOME, appname, "config.yaml") |
|
53 logs_location=os.path.join(xdg.XDG_DATA_HOME, appname, "logs") |
|
54 else: |
|
55 import rumps |
|
56 __base=rumps.application_support(appname) |
|
57 cfgfile=os.path.join(__base, "config.yaml") |
|
58 logs_location=os.path.join(__base, "logs") |
40 |
59 |
41 # |
60 # |
42 # Type checking etc. |
61 # Type checking etc. |
43 # |
62 # |
44 |
63 |
122 else: |
141 else: |
123 out=cfg |
142 out=cfg |
124 |
143 |
125 return out |
144 return out |
126 |
145 |
127 cfgfile=os.path.join(xdg.XDG_CONFIG_HOME, "borgend", "config.yaml") |
146 if not (os.path.exists(cfgfile) and os.path.isfile(cfgfile)): |
|
147 raise SystemExit("Configuration file required: %s" % cfgfile) |
128 |
148 |
129 logger.info("Reading configuration file %s" % cfgfile) |
149 logger.info("Reading configuration %s missing" % cfgfile) |
130 |
|
131 if not (os.path.exists(cfgfile) and os.path.isfile(cfgfile)): |
|
132 raise SystemExit('Configuration file required: {cfgfile}') |
|
133 |
150 |
134 with io.open(cfgfile, 'r') as file: |
151 with io.open(cfgfile, 'r') as file: |
135 settings=expand_env(yaml.load(file), os.environ); |
152 settings=expand_env(yaml.load(file), os.environ); |
136 |
153 |
137 # |
154 # |