-
Notifications
You must be signed in to change notification settings - Fork 148
Open
Description
I would like the plantuml server to be configurable.
For commercial Projects, each call of the plantuml API would leak information to an external party, which is sometimes not allowed.
Having a command line argument to specify the plantuml URL or an environment variable would be nice.
I have a patch which might do the job. It would be nice to have this reviewed and included in an upcomming version. This might also help in resolving #667
index 06c4f4d7f40cb719367d19401085572845a5e14d..d8d31683b6beef0cd082f69b649e179ca7ae7bf6 100644
--- a/doorstop/cli/commands.py
+++ b/doorstop/cli/commands.py
@@ -6,7 +6,7 @@ import os
import time
from typing import Set
-from doorstop import common, server
+from doorstop import common, server, settings
from doorstop.cli import utilities
from doorstop.core import editor, exporter, importer, publisher
from doorstop.core.builder import build
diff --git a/doorstop/cli/main.py b/doorstop/cli/main.py
index eb5756aa46979699c6097ad2d3ff3b3d81510ec2..b2519f87dba00f29d4b4abb5a42411ab60edf5c1 100644
--- a/doorstop/cli/main.py
+++ b/doorstop/cli/main.py
@@ -16,7 +16,6 @@ log = common.logger(__name__)
EDITOR = os.environ.get("EDITOR")
-
def main(args=None): # pylint: disable=R0915
"""Process command-line arguments and run the program."""
from doorstop import CLI, DESCRIPTION, VERSION
@@ -543,7 +542,11 @@ def _publish(subs, shared):
help="Generate top level index (when producing markdown).",
action="store_true",
)
-
+ sub.add_argument(
+ "--plantumlserver",
+ default=settings.PLANTUML_URL,
+ help="specify the pantuml server url",
+ action="store_true" )
if __name__ == "__main__":
main()
diff --git a/doorstop/cli/utilities.py b/doorstop/cli/utilities.py
index 6df48bb9a2575b5bb01e9a10741f1bb22b508699..7c8b5a4299753263dcba5ca9887dec60e7c9bb03 100644
--- a/doorstop/cli/utilities.py
+++ b/doorstop/cli/utilities.py
@@ -107,6 +107,10 @@ def configure_settings(args):
settings.WARN_ALL = args.warn_all is True
if args.error_all is not None:
settings.ERROR_ALL = args.error_all is True
+ if hasattr(args, "plantumlserver") and args.plantumlserver is not None:
+ settings.PLANTUML_URL = args.plantumlserver
+ elif os.environ.get("PLANTUMLURL") is not None:
+ settings.PLANTUML_URL = os.environ.get("PLANTUMLURL")
# Parse `add` settings
if hasattr(args, "server") and args.server is not None:
diff --git a/doorstop/core/publishers/html.py b/doorstop/core/publishers/html.py
index e9a871413b340fb7597dc86520c780a8a3863e54..f36fa059250cd82dbc9b0b2ea5c8707d57df159f 100644
--- a/doorstop/core/publishers/html.py
+++ b/doorstop/core/publishers/html.py
@@ -40,7 +40,7 @@ class HtmlPublisher(MarkdownPublisher):
"markdown.extensions.extra",
"markdown.extensions.sane_lists",
PlantUMLMarkdownExtension(
- server="http://www.plantuml.com/plantuml",
+ server=settings.PLANTUML_URL,
cachedir=tempfile.gettempdir(),
format="svg",
classes="class1,class2",
diff --git a/doorstop/settings.py b/doorstop/settings.py
index 264ef02cb251f41d297ca7575c529dc9c2d555d7..058c8d90665a92bc27c4c8d0ec256a72939de989 100644
--- a/doorstop/settings.py
+++ b/doorstop/settings.py
@@ -63,3 +63,6 @@ CACHE_PATHS = True # cache file/directory paths and contents
# Server settings
SERVER_HOST = None # '' = server not specified, None = no server in use
SERVER_PORT = 7867
+
+# Plantuml server settings
+PLANTUML_URL = "http://www.plantuml.com/plantuml"
\ No newline at end of file
````Metadata
Metadata
Assignees
Labels
No labels