mirror of
https://github.com/SnowMB/traefik-certificate-extractor.git
synced 2025-01-18 22:09:33 +08:00
bugfixes
This commit is contained in:
parent
0c9e004332
commit
cbface8332
@ -15,4 +15,4 @@ RUN pip3 install -r requirements.txt
|
||||
COPY . /app
|
||||
|
||||
# Define entrypoint of the app
|
||||
ENTRYPOINT ["python3", "-u", "extractor.py /data/acme.json /data/certs"]
|
||||
ENTRYPOINT ["python3", "-u", "extractor.py"]
|
||||
|
11
extractor.py
11
extractor.py
@ -84,7 +84,7 @@ def restartContainerWithDomain(domain):
|
||||
# c.restart()
|
||||
|
||||
|
||||
def createCerts(file):
|
||||
def createCerts(file, directory, flat):
|
||||
# Read JSON file
|
||||
data = json.loads(open(file).read())
|
||||
|
||||
@ -117,6 +117,7 @@ def createCerts(file):
|
||||
cert = fullchain[0:start]
|
||||
chain = fullchain[start:]
|
||||
|
||||
|
||||
# Create domain directory if it doesn't exist
|
||||
directory = 'certs/' + name + '/'
|
||||
try:
|
||||
@ -193,12 +194,12 @@ if __name__ == "__main__":
|
||||
help='outputs all certificates into one folder')
|
||||
args = parser.parse_args()
|
||||
|
||||
print('DEBUG: watching path: ' + str(args.FILE))
|
||||
print('DEBUG: output path: ' + str(args.OUTPUT))
|
||||
print('DEBUG: watching path: ' + str(args.certificate))
|
||||
print('DEBUG: output path: ' + str(args.directory))
|
||||
|
||||
# Create output directories if it doesn't exist
|
||||
try:
|
||||
os.makedirs(args.OUTPUT)
|
||||
os.makedirs(args.directory)
|
||||
except OSError as error:
|
||||
if error.errno != errno.EEXIST:
|
||||
raise
|
||||
@ -208,7 +209,7 @@ if __name__ == "__main__":
|
||||
observer = Observer()
|
||||
|
||||
# Register the directory to watch
|
||||
observer.schedule(event_handler, str(args.FILE.parent))
|
||||
observer.schedule(event_handler, str(Path(args.certificate).parent))
|
||||
|
||||
# Main loop to watch the directory
|
||||
observer.start()
|
||||
|
Loading…
x
Reference in New Issue
Block a user