Skip to content

Commit 37c0ec9

Browse files
Merge pull request carlos-jenkins#13 from gisce/config_hooks_path
Allow to configure hooks path
2 parents c6364d5 + 1299515 commit 37c0ec9

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

README.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ You can configure what the application does by changing ``config.json``:
3333
"github_ips_only": true,
3434
"enforce_secret": "",
3535
"return_scripts_info": true
36+
"hooks_path": "/.../hooks/"
3637
}
3738

3839
:github_ips_only: Restrict application to be called only by GitHub IPs. IPs
@@ -48,6 +49,8 @@ You can configure what the application does by changing ``config.json``:
4849
you will be able to see the result of your hooks from within your GitHub
4950
hooks configuration page (see "Recent Deliveries").
5051
Default: ``true``.
52+
:hooks_path: Configures a path to import the hooks. If not set, it'll import
53+
the hooks from the default location (/.../python-github-webhooks/hooks)
5154

5255

5356
Adding Hooks

webhooks.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ def index():
4242
"""
4343

4444
path = normpath(abspath(dirname(__file__)))
45-
hooks = join(path, 'hooks')
4645

4746
# Only POST is implemented
4847
if request.method != 'POST':
@@ -52,6 +51,8 @@ def index():
5251
with open(join(path, 'config.json'), 'r') as cfg:
5352
config = loads(cfg.read())
5453

54+
hooks = config.get('hooks_path', join(path, 'hooks'))
55+
5556
# Allow Github IPs only
5657
if config.get('github_ips_only', True):
5758
src_ip = ip_address(

0 commit comments

Comments
 (0)