added secret key config
This commit is contained in:
20
infomentor/config.py
Normal file
20
infomentor/config.py
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import configparser
|
||||||
|
import os
|
||||||
|
|
||||||
|
_config = None
|
||||||
|
|
||||||
|
def load():
|
||||||
|
global _config
|
||||||
|
if _config is None:
|
||||||
|
_config = configparser.ConfigParser()
|
||||||
|
if not os.path.isfile('infomentor.ini'):
|
||||||
|
_config.add_section('pushover')
|
||||||
|
_config.add_section('general')
|
||||||
|
_config['pushover']['apikey'] = ''
|
||||||
|
_config['general']['secretkey'] = ''
|
||||||
|
with open('infomentor.ini', 'w+') as f:
|
||||||
|
_config.write(f)
|
||||||
|
_config.read('infomentor.ini')
|
||||||
|
return _config
|
||||||
|
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
from infomentor import model, db, icloudcalendar
|
from infomentor import model, db, icloudcalendar, config
|
||||||
import logging
|
import logging
|
||||||
import uuid
|
import uuid
|
||||||
import os
|
import os
|
||||||
@@ -8,7 +8,8 @@ import datetime
|
|||||||
import math
|
import math
|
||||||
import pushover
|
import pushover
|
||||||
from icalendar import Event, vDate, Calendar
|
from icalendar import Event, vDate, Calendar
|
||||||
pushover.init('***REMOVED***')
|
cfg = config.load()
|
||||||
|
pushover.init(cfg['pushover']['apikey'] )
|
||||||
|
|
||||||
class Informer(object):
|
class Informer(object):
|
||||||
'''The Logic part of the infomentor notifier.
|
'''The Logic part of the infomentor notifier.
|
||||||
|
|||||||
@@ -5,10 +5,13 @@ from Crypto.Cipher import AES
|
|||||||
import base64
|
import base64
|
||||||
import enum
|
import enum
|
||||||
import hashlib
|
import hashlib
|
||||||
|
from infomentor import config
|
||||||
|
|
||||||
|
cfg = config.load()
|
||||||
|
|
||||||
ModelBase = declarative_base()
|
ModelBase = declarative_base()
|
||||||
|
|
||||||
_PASSWORD_SECRET_KEY = '***REMOVED***'
|
_PASSWORD_SECRET_KEY = cfg['general']['secretkey']
|
||||||
BS = 16
|
BS = 16
|
||||||
def pad(s):
|
def pad(s):
|
||||||
diff = BS - len(s) % BS
|
diff = BS - len(s) % BS
|
||||||
|
|||||||
Reference in New Issue
Block a user