From 17d044ec20a900b07483409799318d8ec8a9d2b6 Mon Sep 17 00:00:00 2001 From: b3yond Date: Sat, 24 Mar 2018 11:25:14 +0100 Subject: [PATCH] changed config.toml layout for ticketfrei 2.0 #12 --- config.toml.example | 46 +++++++++++---------------------------------- mailbot.py | 2 +- sendmail.py | 6 +++--- 3 files changed, 15 insertions(+), 39 deletions(-) diff --git a/config.toml.example b/config.toml.example index 235653f..ede3336 100644 --- a/config.toml.example +++ b/config.toml.example @@ -1,48 +1,24 @@ -[mapp] -# The bot registers a mastodon app automatically to acquire OAuth keys. -name = 'yourcity_ticketfrei' # What you want the app to be called - -[muser] -enabled = 'false' # set to true if you want to use Mastodon -email = 'youremail@server.tld' # E-mail address of your Mastodon account -password = 'yourpassword' # Password of your Mastodon account -server = 'yourmastodoninstance' # Instance where you have your Mastodon account - -[tapp] +[twitter] # You get those keys when you follow these steps: # https://developer.twitter.com/en/docs/basics/authentication/guides/access-tokens consumer_key = "your_consumer_key" consumer_secret = "your_consumer_secret" -[tuser] -enabled = 'false' # set to true if you want to use Twitter -# You get those keys when you follow these steps: -# https://developer.twitter.com/en/docs/basics/authentication/guides/access-tokens -access_token_key = "your_access_token_key" -access_token_secret = "your_acces_token_secret" +[web] +host = "0.0.0.0" # will be used by bottle as a host. +contact = "b3yond@riseup.net" [mail] -enabled = 'false' # set to true if you want to use Mail notifications -# This is the mail the bot uses to send emails. mailserver = "smtp.riseup.net" -user = "ticketfrei" -passphrase = "sup3rs3cur3" -# If you want to receive crash reports (so you can restart the bot -# when it breaks down), you should specify a contact email address: -#contact = "your_mail@riseup.net" -# Mailing list where you want to send warnings to -list = "yourcity_ticketfrei@lists.links-tech.org" +user = "nbgticketfrei" +passphrase = "5MUIGw,GmSj)t@xW!jixq=b0U+@SJ{K{" [logging] # The directory where logs should be stored. logpath = "logs/ticketfrei.log" -# [trigger] -# goodlists are one regex per line. -# badlists are one badword per line. -# a message musst match at least one regex in goodlist and contain none of the badwords. -# the variables mention the directory where the lists are located, not the filenames. -# These are the default folders. If you want to specify differents folders, uncomment -# those lines and enter relative paths. -#goodlist_path = 'goodlists' -#blacklist_path = 'blacklists' +[database] +db_path = "ticketfrei.sqlite" +# when migrating to mysql: +# username = "username" +# password = "password" \ No newline at end of file diff --git a/mailbot.py b/mailbot.py index 7f8d012..80d8a8d 100644 --- a/mailbot.py +++ b/mailbot.py @@ -48,7 +48,7 @@ class Mailbot(object): self.logger.error("Login to mail server failed", exc_info=True) try: mailer = sendmail.Mailer(config) - mailer.send('', config['mail']['contact'], + mailer.send('', config['web']['contact'], 'Ticketfrei Crash Report', attachment=config['logging']['logpath']) except: diff --git a/sendmail.py b/sendmail.py index 348aefb..df91d1d 100755 --- a/sendmail.py +++ b/sendmail.py @@ -22,13 +22,13 @@ class Mailer(object): """ # This generates the From address by stripping the part until the first # period from the mail server address and won't work always. - self.fromaddr = config["web"]["user"] + "@" + config["web"]["mailserver"].partition(".")[2] + self.fromaddr = config["mail"]["user"] + "@" + config["mail"]["mailserver"].partition(".")[2] # starts a client session with the SMTP server - self.s = smtplib.SMTP(config["web"]["mailserver"]) + self.s = smtplib.SMTP(config["mail"]["mailserver"]) context = ssl.create_default_context() self.s.starttls(context=context) - self.s.login(config["web"]["user"], config["web"]["passphrase"]) + self.s.login(config["mail"]["user"], config["mail"]["passphrase"]) def send(self, text, recipient, subject, attachment=None): """