Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions socket_basics/core/notification/jira_notifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,23 @@ class JiraNotifier(BaseNotifier):
def __init__(self, params: Dict[str, Any] | None = None):
super().__init__(params or {})
# JIRA configuration from params, env variables, or app config
# Parameter names match dashboard config keys (jira_url, jira_project)
self.server = (
self.config.get('server') or
self.config.get('jira_url') or
get_jira_url()
)
self.project = (
self.config.get('project') or
self.config.get('jira_project') or
get_jira_project()
)
self.email = (
self.config.get('email') or
self.config.get('jira_email') or
self.config.get('auth', {}).get('email') or
get_jira_email()
)
self.api_token = (
self.config.get('api_token') or
self.config.get('jira_api_token') or
self.config.get('auth', {}).get('api_token') or
get_jira_api_token()
)

Expand Down
21 changes: 11 additions & 10 deletions socket_basics/core/notification/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,11 @@ def load_from_config(self) -> None:
env_var = p.get('env_variable')
p_type = p.get('type', 'str')

# Resolve value: app_config -> env var -> default
val = None
if self.app_config and pname in self.app_config:
val = self.app_config.get(pname)
if env_var and os.getenv(env_var) is not None:
# Resolve value priority: app_config (highest) -> env var -> default (lowest)
val = p_default

# Check env var (overrides default)
if env_var:
ev = os.getenv(env_var)
if ev is not None:
if p_type == 'bool':
Expand All @@ -223,13 +223,14 @@ def load_from_config(self) -> None:
val = int(ev)
except Exception:
logger.warning("Failed to convert notifier param %s=%s to int for notifier %s; using default %s", pname, ev, name, p_default)
val = p_default
else:
val = ev
else:
val = p_default
else:
val = p_default

# Check app_config (highest priority, overrides env var)
if self.app_config and pname in self.app_config:
app_val = self.app_config.get(pname)
if app_val is not None:
val = app_val

params[pname] = val
else:
Expand Down
4 changes: 2 additions & 2 deletions socket_basics/notifications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ notifiers:
module_path: "socket_basics.core.notification.jira_notifier"
class: "JiraNotifier"
parameters:
- name: server
- name: jira_url
option: --jira-url
env_variable: INPUT_JIRA_URL
type: str
- name: project
- name: jira_project
option: --jira-project
env_variable: INPUT_JIRA_PROJECT
type: str
Expand Down