Update variable naming (#7)
Co-authored-by: Nikolai Rodionov <nikolai.rodionov@grandcentrix.net> Reviewed-on: https://git.badhouseplants.net/allanger/mkdocs-with-confluence/pulls/7
This commit is contained in:
parent
36ae68be6b
commit
162cb4a1bb
2
Makefile
2
Makefile
@ -7,7 +7,7 @@ venv:
|
|||||||
|
|
||||||
run_example:
|
run_example:
|
||||||
|
|
||||||
@docker build -t mkdocs-example -f ./example/Dockerfile --build-arg JIRA_PASSWORD=$(shell sops --decrypt ./example/secret.yaml | yq '.JIRA_PASSWORD' ) .
|
@docker build -t mkdocs-example -f ./example/Dockerfile --build-arg MKDOCS_TO_CONFLUENCE_PASSWORD=$(shell sops --decrypt ./example/secret.yaml | yq '.JIRA_PASSWORD' ) .
|
||||||
@docker run -p 8000:8000 mkdocs-example
|
@docker run -p 8000:8000 mkdocs-example
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
|
@ -9,9 +9,9 @@ RUN mkdir /out
|
|||||||
RUN mv $(find /src/dist -maxdepth 1 -mindepth 1 -name '*tar.gz') /out/mkdocs_with_confluence.tar.gz
|
RUN mv $(find /src/dist -maxdepth 1 -mindepth 1 -name '*tar.gz') /out/mkdocs_with_confluence.tar.gz
|
||||||
|
|
||||||
FROM BUILDER as common_builder
|
FROM BUILDER as common_builder
|
||||||
|
ARG MKDOCS_TO_CONFLUENCE_PASSWORD
|
||||||
ENV MKDOCS_TO_CONFLUENCE=true
|
ENV MKDOCS_TO_CONFLUENCE=true
|
||||||
ARG JIRA_PASSWORD
|
ENV MKDOCS_TO_CONFLUENCE_PASSWORD=$MKDOCS_TO_CONFLUENCE_PASSWORD
|
||||||
ENV JIRA_PASSWORD=$JIRA_PASSWORD
|
|
||||||
RUN pip install mkdocs mkdocs-material
|
RUN pip install mkdocs mkdocs-material
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
COPY ./example /src
|
COPY ./example /src
|
||||||
|
@ -22,6 +22,7 @@ from pathlib import Path
|
|||||||
|
|
||||||
ENABLE_ENV_VAR = "MKDOCS_TO_CONFLUENCE"
|
ENABLE_ENV_VAR = "MKDOCS_TO_CONFLUENCE"
|
||||||
DRY_RUN_ENV_VAR = "MKDOCS_TO_CONFLUENCE_DRY_RUN"
|
DRY_RUN_ENV_VAR = "MKDOCS_TO_CONFLUENCE_DRY_RUN"
|
||||||
|
|
||||||
TEMPLATE_BODY = "<p> TEMPLATE </p>"
|
TEMPLATE_BODY = "<p> TEMPLATE </p>"
|
||||||
HEADER_WARNING = "‼️ This page is created automatically, all you changes will be overwritten during the next MKDocs deployment. Do not edit a page here ‼️"
|
HEADER_WARNING = "‼️ This page is created automatically, all you changes will be overwritten during the next MKDocs deployment. Do not edit a page here ‼️"
|
||||||
SECTION_PAGE_CONTENT = "<p> It's just a Section Page </p>"
|
SECTION_PAGE_CONTENT = "<p> It's just a Section Page </p>"
|
||||||
@ -45,8 +46,8 @@ class MkdocsWithConfluence(BasePlugin):
|
|||||||
("host_url", config_options.Type(str, default=None)),
|
("host_url", config_options.Type(str, default=None)),
|
||||||
("space", config_options.Type(str, default=None)),
|
("space", config_options.Type(str, default=None)),
|
||||||
("parent_page_name", config_options.Type(str, default=None)),
|
("parent_page_name", config_options.Type(str, default=None)),
|
||||||
("username", config_options.Type(str, default=environ.get("JIRA_USERNAME", None))),
|
("username", config_options.Type(str, default=environ.get("MKDOCS_TO_CONFLUENCE_USER", None))),
|
||||||
("password", config_options.Type(str, default=environ.get("JIRA_PASSWORD", None))),
|
("password", config_options.Type(str, default=environ.get("MKDOCS_TO_CONFLUENCE_PASSWORD", None))),
|
||||||
("dryrun", config_options.Type(bool, default=False)),
|
("dryrun", config_options.Type(bool, default=False)),
|
||||||
("header_message", config_options.Type(str, default=None)),
|
("header_message", config_options.Type(str, default=None)),
|
||||||
("upstream_url", config_options.Type(str, default=None)),
|
("upstream_url", config_options.Type(str, default=None)),
|
||||||
@ -107,6 +108,7 @@ class MkdocsWithConfluence(BasePlugin):
|
|||||||
|
|
||||||
|
|
||||||
def on_files(self, files, config):
|
def on_files(self, files, config):
|
||||||
|
if self.enabled:
|
||||||
pages = files.documentation_pages()
|
pages = files.documentation_pages()
|
||||||
try:
|
try:
|
||||||
self.flen = len(pages)
|
self.flen = len(pages)
|
||||||
@ -115,7 +117,7 @@ class MkdocsWithConfluence(BasePlugin):
|
|||||||
logger.error("no files found to be synced")
|
logger.error("no files found to be synced")
|
||||||
|
|
||||||
def on_page_markdown(self, markdown, page, config, files):
|
def on_page_markdown(self, markdown, page, config, files):
|
||||||
# TODO: Modify pages here
|
if self.enabled:
|
||||||
try:
|
try:
|
||||||
self.session.auth = (self.config["username"], self.config["password"])
|
self.session.auth = (self.config["username"], self.config["password"])
|
||||||
confluencePageName = page.url[0:-1]
|
confluencePageName = page.url[0:-1]
|
||||||
@ -194,6 +196,7 @@ class MkdocsWithConfluence(BasePlugin):
|
|||||||
return markdown
|
return markdown
|
||||||
|
|
||||||
def on_post_page(self, output, page, config):
|
def on_post_page(self, output, page, config):
|
||||||
|
if self.enabled:
|
||||||
logger.info("The author was uploading images here, maybe there was a reason for that")
|
logger.info("The author was uploading images here, maybe there was a reason for that")
|
||||||
|
|
||||||
def on_page_content(self, html, page, config, files):
|
def on_page_content(self, html, page, config, files):
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "mkdocs-with-confluence"
|
name = "mkdocs-with-confluence"
|
||||||
version = "0.3.1"
|
version = "0.3.2"
|
||||||
description = "MkDocs plugin for uploading markdown documentation to Confluence via Confluence REST API"
|
description = "MkDocs plugin for uploading markdown documentation to Confluence via Confluence REST API"
|
||||||
authors = ["Nikolai Rodionov <allanger@zohomail.com>"]
|
authors = ["Nikolai Rodionov <allanger@zohomail.com>"]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
Loading…
Reference in New Issue
Block a user