changed config.toml layout for ticketfrei 2.0 #12

This commit is contained in:
b3yond 2018-03-24 11:25:14 +01:00
parent be118fb4bd
commit 17d044ec20
3 changed files with 15 additions and 39 deletions

View file

@ -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"

View file

@ -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:

View file

@ -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):
"""