Przeglądaj źródła

graylog: Use config file to source API token

Philipp Fromme 2 lat temu
rodzic
commit
84557e13b0
1 zmienionych plików z 4 dodań i 1 usunięć
  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'}