Skip to content

Commit 0426fd3

Browse files
muffl0nbwplotka
andauthored
Get password in example from environment (#190)
* get password in example from environment Signed-off-by: Sven Schliesing <s.schliesing@ndr.de> * Updared README and grammar. Signed-off-by: bwplotka <bwplotka@gmail.com> --------- Signed-off-by: Sven Schliesing <s.schliesing@ndr.de> Signed-off-by: bwplotka <bwplotka@gmail.com> Co-authored-by: bwplotka <bwplotka@gmail.com>
1 parent c524af4 commit 0426fd3

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ The configuration file is essentially a list of receivers matching 1-to-1 all Al
5555

5656
Each receiver must have a unique name (matching the Alertmanager receiver name), JIRA API access fields (URL, username and password), a handful of required issue fields (such as the JIRA project and issue summary), some optional issue fields (e.g. priority) and a `fields` map for other (standard or custom) JIRA fields. Most of these may use [Go templating](https://golang.org/pkg/text/template/) to generate the actual field values based on the contents of the Alertmanager notification. The exact same data structures and functions as those defined in the [Alertmanager template reference](https://prometheus.io/docs/alerting/notifications/) are available in JIRAlert.
5757

58+
Similar to Alertmanager, jiralert supports environment variable substitution with the `$(...)` syntax.
59+
5860
## Alertmanager configuration
5961

6062
To enable Alertmanager to talk to JIRAlert you need to configure a webhook in Alertmanager. You can do that by adding a webhook receiver to your Alertmanager configuration.

examples/jiralert.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ defaults:
44
# API access fields.
55
api_url: https://jiralert.atlassian.net
66
user: jiralert
7-
password: 'JIRAlert'
7+
# Get password from the $PASSWORD environment variable.
8+
password: $(PASSWORD)
89
# Alternatively to user and password use a Personal Access Token
910
# personal_access_token: "Your Personal Access Token". See https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html
1011

pkg/config/config_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ func TestLoadFile(t *testing.T) {
9898

9999
// Checks if the env var substitution is happening correctly in the loaded file
100100
func TestEnvSubstitution(t *testing.T) {
101-
102101
config := "user: $(JA_USER)"
103102
os.Setenv("JA_USER", "user")
104103

@@ -110,7 +109,6 @@ func TestEnvSubstitution(t *testing.T) {
110109
config = "user: $(JA_MISSING)"
111110
_, err = substituteEnvVars([]byte(config), log.NewNopLogger())
112111
require.Error(t, err)
113-
114112
}
115113

116114
// A test version of the ReceiverConfig struct to create test yaml fixtures.

0 commit comments

Comments
 (0)