This commit is contained in:
rune 2023-04-13 09:29:07 +02:00
parent 5bd4b9b781
commit 440e9df633

View File

@ -48,8 +48,9 @@ def connect_database():
api text NOT NULL)''') api text NOT NULL)''')
c.execute('''CREATE TABLE IF NOT EXISTS settings ( c.execute('''CREATE TABLE IF NOT EXISTS settings (
id INTEGER NOT NULL PRIMARY KEY, id INTEGER NOT NULL PRIMARY KEY,
first_run INTEGER DEFAULT 0, first_run INTEGER,
server TEXT DEFAULT "TEST" server TEXT,
data_copy INTEGER"
)''') )''')
c.execute('''CREATE TABLE IF NOT EXISTS aliases c.execute('''CREATE TABLE IF NOT EXISTS aliases
(id integer NOT NULL PRIMARY KEY, (id integer NOT NULL PRIMARY KEY,
@ -151,6 +152,12 @@ def delete(alias):
print('Delete : ' + alias) print('Delete : ' + alias)
def copy_data():
print('copy')
def checklist(alias): def checklist(alias):
apikey = get_api() apikey = get_api()
mail_server = get_settings('mail_server') mail_server = get_settings('mail_server')
@ -267,6 +274,9 @@ parser.add_argument('-a', '--add', help='Add new alias.\n\n',
parser.add_argument('-v', '--version', help='Show current version and config info\n\n', parser.add_argument('-v', '--version', help='Show current version and config info\n\n',
required=False, action='store_true') required=False, action='store_true')
parser.add_argument('-c', '--copy', help='Copy alias data from MailCow server to local DB.\n\n',
required=False, action='store_true')
args = vars(parser.parse_args()) args = vars(parser.parse_args())
if args['api']: if args['api']:
@ -279,6 +289,8 @@ elif args['add']:
create(args['add'][0][0],args['add'][0][1]) create(args['add'][0][0],args['add'][0][1])
elif args['version']: elif args['version']:
show_current_info() show_current_info()
elif args['version']:
copy_data()
else: else: