Browse Source

graylog: Use config file to source API token

Philipp Fromme 1 year ago
parent
commit
84557e13b0
1 changed files with 4 additions and 1 deletions
  1. 4 1
      graylog/graylog-system-notifications

+ 4 - 1
graylog/graylog-system-notifications

@@ -21,7 +21,10 @@ import logging
 import json
 import requests
 
-api_token = '{{ graylog_config['api_token'] }}'
+general_config_path = "/etc/graylog-api-scripts.conf"
+general_config = configparser.ConfigParser()
+general_config.read(general_config_path)
+api_token = general_config['DEFAULTS']['token']
 api_token_password = 'token'
 api_url_base = 'http://127.0.0.1:9000/api'
 headers = {'Content-Type': 'application/json', 'X-Requested-By': 'cli'}