feat(output): Allow to use 'DIAGRAMS_FILENAME' and 'DIAGRAMS_OUTFORMAT' environment variables to override the default value

pull/736/head
Thomas Senay 3 years ago
parent b626d57240
commit fae52d3687

@ -104,7 +104,7 @@ class Diagram:
""" """
self.name = name self.name = name
if not name and not filename: if not name and not filename:
filename = "diagrams_image" filename = os.environ.get('DIAGRAMS_FILENAME', "diagrams_image")
elif not filename: elif not filename:
filename = "_".join(self.name.split()).lower() filename = "_".join(self.name.split()).lower()
self.filename = filename self.filename = filename
@ -134,7 +134,7 @@ class Diagram:
else: else:
if not self._validate_outformat(outformat): if not self._validate_outformat(outformat):
raise ValueError(f'"{outformat}" is not a valid output format') raise ValueError(f'"{outformat}" is not a valid output format')
self.outformat = outformat self.outformat = os.environ.get('DIAGRAMS_OUTFORMAT', outformat)
# Merge passed in attributes # Merge passed in attributes
self.dot.graph_attr.update(graph_attr) self.dot.graph_attr.update(graph_attr)

Loading…
Cancel
Save