mirror of
https://github.com/janeczku/calibre-web
synced 2025-12-22 15:22:01 +00:00
Added SSL Options (#416)
This commit is contained in:
24
cps/cli.py
24
cps/cli.py
@@ -3,11 +3,14 @@
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
|
||||
parser = argparse.ArgumentParser(description='Calibre Web is a web app'
|
||||
' providing a interface for browsing, reading and downloading eBooks\n', prog='cps.py')
|
||||
parser.add_argument('-p', metavar='path', help='path and name to settings db, e.g. /opt/cw.db')
|
||||
parser.add_argument('-g', metavar='path', help='path and name to gdrive db, e.g. /opt/gd.db')
|
||||
parser.add_argument('-c', metavar='path', help='path and name to SSL certfile, e.g. /opt/test.cert, works only in combination with keyfile')
|
||||
parser.add_argument('-k', metavar='path', help='path and name to SSL keyfile, e.g. /opt/test.key, works only in combination with certfile')
|
||||
args = parser.parse_args()
|
||||
|
||||
generalPath = os.path.normpath(os.getenv("CALIBRE_DBPATH",
|
||||
@@ -22,3 +25,24 @@ if args.g:
|
||||
else:
|
||||
gdpath = os.path.join(generalPath, "gdrive.db")
|
||||
|
||||
certfilepath = None
|
||||
keyfilepath = None
|
||||
if args.c:
|
||||
if os.path.isfile(args.c):
|
||||
certfilepath = args.c
|
||||
else:
|
||||
print("Certfilepath is invalid. Exiting...")
|
||||
sys.exit(1)
|
||||
|
||||
if args.c is "":
|
||||
certfilepath = ""
|
||||
|
||||
if args.k:
|
||||
if os.path.isfile(args.k):
|
||||
keyfilepath = args.k
|
||||
else:
|
||||
print("Keyfilepath is invalid. Exiting...")
|
||||
sys.exit(1)
|
||||
|
||||
if args.k is "":
|
||||
keyfilepath = ""
|
||||
|
||||
Reference in New Issue
Block a user