Skip to content

Commit

Permalink
Add settings:
Browse files Browse the repository at this point in the history
* DD_SEARCH_SCM_TYPE - flag to enable/disable scm_type search
* DD_DEFAULT_SCM_TYPE - default value for scm_type
* DD_JIRA_CONNECT_METHOD - import path for jira connect method
  • Loading branch information
Kurochkin Dmitriy Vadimovich committed Jan 10, 2025
1 parent 97e38c8 commit 69d6928
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dojo/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3197,7 +3197,7 @@ def get_scm_type(self):
st = dojo_meta.value.strip()
if st:
return st.lower()
return ""
return settings.DEFAULT_SCM_TYPE

def scm_public_prepare_base_link(self, uri):
# scm public (https://scm-domain.org) url template for browse is:
Expand Down
15 changes: 15 additions & 0 deletions dojo/settings/settings.dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,10 @@
# For HTTP requests, how long connection is open before timeout
# This settings apply only on requests performed by "requests" lib used in Dojo code (if some included lib is using "requests" as well, this does not apply there)
DD_REQUESTS_TIMEOUT=(int, 30),
# When scm-type is not found for a product returns the specified value
DD_DEFAULT_SCM_TYPE=(str, ""),
# When set, use this method for connect to jira
DD_JIRA_CONNECT_METHOD=(str, ""),
)


Expand Down Expand Up @@ -1807,6 +1811,17 @@ def saml2_attrib_map_format(dict):
# ------------------------------------------------------------------------------
REQUESTS_TIMEOUT = env("DD_REQUESTS_TIMEOUT")

if env("DD_DEFAULT_SCM_TYPE") in ["github", "gitlab", "gitea", "codeberg", "bitbucket", "bitbucket-standalone"]:
DEFAULT_SCM_TYPE = env("DD_DEFAULT_SCM_TYPE")
else:
DEFAULT_SCM_TYPE = ""

# Example:
# For file /app/dojo/jira_link/helper_jira.py with method connect_to_jira_by_token(jira_server, _, jira_token)
# DD_JIRA_CONNECT_METHOD = dojo.jira_link.helper_jira.connect_to_jira_by_token
if env("DD_JIRA_CONNECT_METHOD"):
JIRA_CONNECT_METHOD = env("DD_JIRA_CONNECT_METHOD")

# ------------------------------------------------------------------------------
# Ignored Warnings
# ------------------------------------------------------------------------------
Expand Down

0 comments on commit 69d6928

Please sign in to comment.