瀏覽代碼

graylog: Use config file to source API token

Philipp Fromme 2 年之前
父節點
當前提交
84557e13b0
共有 1 個文件被更改,包括 4 次插入1 次删除
  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'}