Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
GÉANT Service Orchestrator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GÉANT Orchestration and Automation Team
GAP
GÉANT Service Orchestrator
Commits
f1e313db
Verified
Commit
f1e313db
authored
9 months ago
by
Karel van Klink
Browse files
Options
Downloads
Patches
Plain Diff
Add mail recipient to oss params
parent
01016f7a
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
gso/oss-params-example.json
+2
-1
2 additions, 1 deletion
gso/oss-params-example.json
gso/services/mailer.py
+4
-4
4 additions, 4 deletions
gso/services/mailer.py
gso/settings.py
+7
-4
7 additions, 4 deletions
gso/settings.py
with
13 additions
and
9 deletions
gso/oss-params-example.json
+
2
−
1
View file @
f1e313db
...
...
@@ -90,7 +90,8 @@
"smtp_port"
:
487
,
"starttls_enabled"
:
true
,
"smtp_username"
:
"username"
,
"smtp_password"
:
"password"
"smtp_password"
:
"password"
,
"notification_email_destinations"
:
"oc@nren.local, neteng@nren.local, ceo@nren.local"
},
"SHAREPOINT"
:
{
"client_id"
:
"UUID"
,
...
...
This diff is collapsed.
Click to expand it.
gso/services/mailer.py
+
4
−
4
View file @
f1e313db
...
...
@@ -7,19 +7,19 @@ from ssl import create_default_context
from
gso.settings
import
load_oss_params
def
send_mail
(
recipient
:
str
,
subject
:
str
,
body
:
str
)
->
None
:
"""
Send an email message to the given address.
def
send_mail
(
recipient
s
:
str
,
subject
:
str
,
body
:
str
)
->
None
:
"""
Send an email message to the given address
es
.
Only supports STARTTLS, not SSL.
:param str recipient: The destination address.
:param str recipient
s
: The destination address
es, comma separated
.
:param str subject: The email subject.
:param str body: The contents of the email message.
"""
email_params
=
load_oss_params
().
EMAIL
msg
=
EmailMessage
()
msg
[
"
From
"
]
=
email_params
.
from_address
msg
[
"
To
"
]
=
recipient
msg
[
"
To
"
]
=
recipient
s
msg
[
"
Subject
"
]
=
subject
msg
.
set_content
(
body
)
...
...
This diff is collapsed.
Click to expand it.
gso/settings.py
+
7
−
4
View file @
f1e313db
...
...
@@ -11,12 +11,13 @@ import os
from
pathlib
import
Path
from
typing
import
Annotated
from
pydantic
import
Field
from
pydantic
import
EmailStr
,
Field
from
pydantic_forms.types
import
UUIDstr
from
pydantic_settings
import
BaseSettings
from
typing_extensions
import
Doc
from
gso.products.product_blocks.site
import
SiteTier
from
gso.utils.shared_enums
import
PortNumber
logger
=
logging
.
getLogger
(
__name__
)
...
...
@@ -152,13 +153,15 @@ class NetBoxParams(BaseSettings):
class
EmailParams
(
BaseSettings
):
"""
Parameters for the email service.
"""
# TODO: Use more strict types after we've migrated to Pydantic 2.x
from_address
:
str
from_address
:
EmailStr
smtp_host
:
str
smtp_port
:
int
smtp_port
:
PortNumber
starttls_enabled
:
bool
smtp_username
:
str
|
None
=
None
smtp_password
:
str
|
None
=
None
#: List of email addresses that should receive notifications when validation of a subscription fails.
#: Can be a comma-separated list of multiple addresses.
notification_email_destinations
:
str
class
SharepointParams
(
BaseSettings
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment