mirror of
https://github.com/FAUSheppy/atlantis-event-dispatcher
synced 2026-04-26 15:32:28 +02:00
Compare commits
3 Commits
f7b6ccb740
...
f468a789e3
| Author | SHA1 | Date | |
|---|---|---|---|
| f468a789e3 | |||
| 527fa97dc8 | |||
| 000b7d2f43 |
@@ -174,6 +174,8 @@ if __name__ == "__main__":
|
||||
smtp_pass = args.smtp_pass or os.environ.get("SMTP_PASS")
|
||||
smtp_port = args.smtp_port or os.environ.get("SMTP_PORT")
|
||||
|
||||
polling_interval = int(os.environ.get("POLLING_INTERVAL_SECONDS") or 5)
|
||||
|
||||
first_run = True
|
||||
while args.loop or first_run:
|
||||
|
||||
@@ -228,7 +230,7 @@ if __name__ == "__main__":
|
||||
|
||||
# wait a moment #
|
||||
if args.loop:
|
||||
time.sleep(5)
|
||||
time.sleep(polling_interval)
|
||||
|
||||
# handle non-loop runs #
|
||||
first_run = False
|
||||
|
||||
@@ -398,6 +398,15 @@ def save_in_dispatch_queue(persons, title, message, method, link=""):
|
||||
dispatch_secret = secrets.token_urlsafe(32)
|
||||
|
||||
master_method = "any"
|
||||
|
||||
# handle bytes input #
|
||||
def normalize(v):
|
||||
return v.decode("utf-8") if isinstance(v, bytes) else v
|
||||
|
||||
p.username = normalize(p.username)
|
||||
p.phone = normalize(p.phone)
|
||||
p.email = normalize(p.email)
|
||||
|
||||
obj = DispatchObject(username=p.username,
|
||||
phone=p.phone,
|
||||
email=p.email,
|
||||
@@ -440,7 +449,7 @@ def create_app():
|
||||
app.config["SUBSTITUTIONS"] = {}
|
||||
if os.path.isfile(substitution_config_file):
|
||||
with open(substitution_config_file) as f:
|
||||
app.config["SUBSTITUTIONS"] = yaml.safe_load(f)
|
||||
app.config["SUBSTITUTIONS"] = yaml.safe_load(f) or {}
|
||||
|
||||
print("Loaded subs:", substitution_config_file, app.config["SUBSTITUTIONS"], file=sys.stderr)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user