mirror of
https://github.com/FAUSheppy/simple-webhook-handler
synced 2025-12-11 22:28:33 +01:00
add config parser
This commit is contained in:
@@ -6,6 +6,7 @@ import json
|
|||||||
app = flask.Flask("webhook-listener")
|
app = flask.Flask("webhook-listener")
|
||||||
TOKEN_HEADER = "X-Gitlab-Token"
|
TOKEN_HEADER = "X-Gitlab-Token"
|
||||||
PROJECT_IDENTIFIER = "web_url"
|
PROJECT_IDENTIFIER = "web_url"
|
||||||
|
SEPERATOR = ","
|
||||||
config = {}
|
config = {}
|
||||||
|
|
||||||
##### FRONTEND PATHS ########
|
##### FRONTEND PATHS ########
|
||||||
@@ -26,8 +27,12 @@ def rootPage():
|
|||||||
return ("Rejected: secret token found but is mismatch", 403)
|
return ("Rejected: secret token found but is mismatch", 403)
|
||||||
|
|
||||||
|
|
||||||
def readExecutionConfig():
|
def readExecutionConfig(configFile):
|
||||||
pass
|
global config
|
||||||
|
with open(configFile, "r") as f:
|
||||||
|
for line in f:
|
||||||
|
projectIdent, token, scriptName = line.split(SEPERATOR)
|
||||||
|
config.update({projectIdent:(token, scriptName)})
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
@@ -38,4 +43,6 @@ if __name__ == "__main__":
|
|||||||
parser.add_argument("-p", "--port", default="5000", help="Port to listen on")
|
parser.add_argument("-p", "--port", default="5000", help="Port to listen on")
|
||||||
parser.add_argument("-c", default="webhook.config", help="Config for handling of webhooks")
|
parser.add_argument("-c", default="webhook.config", help="Config for handling of webhooks")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
readExecutionConfig(args.c)
|
||||||
app.run(host=args.interface, port=args.port)
|
app.run(host=args.interface, port=args.port)
|
||||||
|
|||||||
Reference in New Issue
Block a user