mirror of
https://github.com/SnowMB/traefik-certificate-extractor.git
synced 2025-01-19 06:19: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
|
COPY . /app
|
||||||
|
|
||||||
# Define entrypoint of the 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()
|
# c.restart()
|
||||||
|
|
||||||
|
|
||||||
def createCerts(file):
|
def createCerts(file, directory, flat):
|
||||||
# Read JSON file
|
# Read JSON file
|
||||||
data = json.loads(open(file).read())
|
data = json.loads(open(file).read())
|
||||||
|
|
||||||
@ -117,6 +117,7 @@ def createCerts(file):
|
|||||||
cert = fullchain[0:start]
|
cert = fullchain[0:start]
|
||||||
chain = fullchain[start:]
|
chain = fullchain[start:]
|
||||||
|
|
||||||
|
|
||||||
# Create domain directory if it doesn't exist
|
# Create domain directory if it doesn't exist
|
||||||
directory = 'certs/' + name + '/'
|
directory = 'certs/' + name + '/'
|
||||||
try:
|
try:
|
||||||
@ -193,12 +194,12 @@ if __name__ == "__main__":
|
|||||||
help='outputs all certificates into one folder')
|
help='outputs all certificates into one folder')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
print('DEBUG: watching path: ' + str(args.FILE))
|
print('DEBUG: watching path: ' + str(args.certificate))
|
||||||
print('DEBUG: output path: ' + str(args.OUTPUT))
|
print('DEBUG: output path: ' + str(args.directory))
|
||||||
|
|
||||||
# Create output directories if it doesn't exist
|
# Create output directories if it doesn't exist
|
||||||
try:
|
try:
|
||||||
os.makedirs(args.OUTPUT)
|
os.makedirs(args.directory)
|
||||||
except OSError as error:
|
except OSError as error:
|
||||||
if error.errno != errno.EEXIST:
|
if error.errno != errno.EEXIST:
|
||||||
raise
|
raise
|
||||||
@ -208,7 +209,7 @@ if __name__ == "__main__":
|
|||||||
observer = Observer()
|
observer = Observer()
|
||||||
|
|
||||||
# Register the directory to watch
|
# 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
|
# Main loop to watch the directory
|
||||||
observer.start()
|
observer.start()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user