diff --git a/Dockerfile b/Dockerfile index 6c3ecce..c71f6f1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] diff --git a/extractor.py b/extractor.py index 1dd0ac6..5f9744f 100644 --- a/extractor.py +++ b/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()