diff --git a/auth-mastodon.py b/auth-mastodon.py index c7b79aa..e7d9cdb 100644 --- a/auth-mastodon.py +++ b/auth-mastodon.py @@ -1,6 +1,8 @@ #!/usr/bin/env python3 + import os, sys, logging, struct, psycopg2, bcrypt, random, atexit, time + # Database connection details. The credentials here need access to the Mastodon database, which "ejabberd" is unlikely # to have on your system by default. You shoud grant SELECT privileges to ejabberd on the "accounts" and "users" tables, # to play it safe, or include the Mastodon DB user credentials here (don't). @@ -38,16 +40,21 @@ except: time.sleep(10) sys.exit(1) + @atexit.register def close_db(): cursor.close() database.close() + logging.info('auth-mastodon script started, waiting for ejabberd requests') + class EjabberdInputError(Exception): + def __init__(self, value): self.value = value + def __str__(self): return repr(self.value)