Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
govdelivery_bulletins
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
govdelivery_bulletins
Commits
8ea838f2
Commit
8ea838f2
authored
10 months ago
by
Steve Wirt
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#3442081
by swirt, RichardDavies: Improve description of endpoint configuration
parent
72a6325f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
README.md
+14
-2
14 additions, 2 deletions
README.md
src/Form/GovDeliveryBulletinsAdminForm.php
+46
-35
46 additions, 35 deletions
src/Form/GovDeliveryBulletinsAdminForm.php
with
60 additions
and
37 deletions
README.md
+
14
−
2
View file @
8ea838f2
...
...
@@ -12,6 +12,19 @@ The two checkboxes in the "Basic operations" section of the admin should start
out being disabled. With them off, Bulletins are not queued and the queue is
not processed.
**Caution**
Only turn them both on when you are ready to send.
### What should I use for the GovDelivery API endpoint setting?
There are a few styles of endpoint definitions.
-
Staging - Useful for initial testing and you may want to set up your
lower environments to point to it.
-
Send immediately: https://stage-api.govdelivery.com/api/account/ACCOUNT_CODE/bulletins/send_now
-
Create draft Bulletin: https://stage-api.govdelivery.com/api/account/ACCOUNT_CODE/bulletins.xml
-
Production
-
Send immediately: https://api.govdelivery.com/api/account/ACCOUNT_CODE/bulletins/send_now
-
Create draft Bulletin: https://api.govdelivery.com/api/account/ACCOUNT_CODE/bulletins.xml
Your ACCOUNT_CODE can be found via the GovDelivery administrative interface.
Look in the URL.
### How to use the service to add a bulletin to the queue.
The service to add a Bulletin to the queue can be called from anything that you
would like to have perform this [ Example: hook_entity_insert(),
...
...
@@ -70,12 +83,11 @@ $apiUsername = $config->get('govdelivery_username');
$apiPassword = $config->get('govdelivery_password');
```
You can also save your username and password by setting them in the
GovDelivery
You can also save your username and password by setting them in the GovDelivery
Bulletins Admin form /admin/config/services/govdelivery-bulletins/settings.
This is strongly discouraged, and presents a security vulnerability.
### Why does this use a queue?
*
A queue makes sure that in the event of a problem reaching the GovDelivery
...
...
This diff is collapsed.
Click to expand it.
src/Form/GovDeliveryBulletinsAdminForm.php
+
46
−
35
View file @
8ea838f2
...
...
@@ -54,7 +54,51 @@ class GovDeliveryBulletinsAdminForm extends FormBase {
'#default_value'
=>
$config
->
get
(
'enable_bulletin_queue_sends_to_govdelivery'
),
];
$form
[
'api_queue_trigger_enabled'
]
=
[
$account_info_description
=
'<strong>'
.
$this
->
t
(
'WARNING:'
)
.
'</strong>'
;
$account_info_description
.
=
$this
->
t
(
'These fields store GovDelivery account info in the database. - THIS IS NOT RECOMMENDED.
Preferred method is to store in settings.local.php and use environment variables - see README for instructions.'
);
$form
[
'account-info'
]
=
[
'#type'
=>
'fieldset'
,
'#title'
=>
$this
->
t
(
'GovDelivery Account Information'
),
'#description'
=>
$account_info_description
,
];
$account_description
=
$this
->
t
(
'The endpoint ususually resembles this pattern:'
);
$account_description
.
=
'</br> https://api.govdelivery.com/api/account/ACCOUNT_CODE/bulletins/send_now'
;
$account_description
.
=
'</br>'
.
$this
->
t
(
'Your ACCOUNT_CODE can be found via the GovDelivery administrative interface. Look in the URL.'
);
$form
[
'account-info'
][
'govdelivery_endpoint'
]
=
[
'#type'
=>
'textfield'
,
'#title'
=>
$this
->
t
(
'GovDelivery API Endpoint'
),
'#description'
=>
$account_description
,
'#weight'
=>
'6'
,
'#default_value'
=>
$config
->
get
(
'govdelivery_endpoint'
),
];
$form
[
'account-info'
][
'govdelivery_username'
]
=
[
'#type'
=>
'textfield'
,
'#title'
=>
$this
->
t
(
'GovDelivery Username'
),
'#description'
=>
$this
->
t
(
'The username for the GovDelivery account that should be used.'
),
'#weight'
=>
'6'
,
'#default_value'
=>
$config
->
get
(
'govdelivery_username'
),
];
$form
[
'account-info'
][
'govdelivery_password'
]
=
[
'#type'
=>
'password'
,
'#title'
=>
$this
->
t
(
'GovDelivery Password'
),
'#description'
=>
$this
->
t
(
'The password for the GovDelivery account that should be use.'
),
'#weight'
=>
'7'
,
'#default_value'
=>
$config
->
get
(
'govdelivery_password'
),
];
$form
[
'remote-trigger'
]
=
[
'#type'
=>
'fieldset'
,
'#title'
=>
$this
->
t
(
'Remote trigger'
),
'#description'
=>
$this
->
t
(
'This enables sending items in the queue by making a GET request. It is useful for decoupled sites whose content may lag behind Drupal.'
),
];
$form
[
'remote-trigger'
][
'api_queue_trigger_enabled'
]
=
[
'#type'
=>
'checkbox'
,
'#title'
=>
$this
->
t
(
'Enable API Queue Trigger'
),
'#description'
=>
$this
->
t
(
...
...
@@ -77,7 +121,7 @@ class GovDeliveryBulletinsAdminForm extends FormBase {
$status
=
"basic_auth: <strong>
{
$this
->
t
(
'disabled'
)
}
</strong>"
;
$description
=
"
{
$description
}
<br/><strong>
{
$caution
}
</strong><br/>
{
$status
}
"
;
}
$form
[
'api_queue_trigger_allow_basic_auth'
]
=
[
$form
[
'
remote-trigger'
][
'
api_queue_trigger_allow_basic_auth'
]
=
[
'#type'
=>
'checkbox'
,
'#title'
=>
$this
->
t
(
'Allow @basic_auth to be used to access API Queue Trigger'
,
[
'@basic_auth'
=>
'basic_auth'
]),
'#description'
=>
$description
,
...
...
@@ -85,39 +129,6 @@ class GovDeliveryBulletinsAdminForm extends FormBase {
'#default_value'
=>
$config
->
get
(
'api_queue_trigger_allow_basic_auth'
),
];
$form
[
'govdelivery_endpoint'
]
=
[
'#type'
=>
'textfield'
,
'#title'
=>
$this
->
t
(
'GovDelivery API Endpoint'
),
'#description'
=>
$this
->
t
(
'Stores GovDelivery api endpoint in database - THIS IS NOT RECOMMENDED.
Preferred method is to store in settings.local.php - see README for
instructions.'
),
'#weight'
=>
'6'
,
'#default_value'
=>
$config
->
get
(
'govdelivery_endpoint'
),
];
$form
[
'govdelivery_username'
]
=
[
'#type'
=>
'textfield'
,
'#title'
=>
$this
->
t
(
'GovDelivery Username'
),
'#description'
=>
$this
->
t
(
'Stores GovDelivery username in database - THIS IS NOT RECOMMENDED.
Preferred method is to store in settings.local.php - see README for
instructions.'
),
'#weight'
=>
'6'
,
'#default_value'
=>
$config
->
get
(
'govdelivery_username'
),
];
$form
[
'govdelivery_password'
]
=
[
'#type'
=>
'password'
,
'#title'
=>
$this
->
t
(
'GovDelivery Password'
),
'#description'
=>
$this
->
t
(
'Stores GovDelivery password in database - THIS IS NOT RECOMMENDED.
Preferred method is to store in settings.local.php - see README for
instructions.'
),
'#weight'
=>
'7'
,
'#default_value'
=>
$config
->
get
(
'govdelivery_password'
),
];
$form
[
'submit'
]
=
[
'#type'
=>
'submit'
,
'#value'
=>
$this
->
t
(
'Submit'
),
...
...
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