Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to read configuration settings from custom hooks?

We are moving from HG to Rhodecode and we are using custom buildbot hook for building on push event. As mentioned here it is straight forward to add custom mercurial hook in Rhodecode. The issue is we are reading the configuration, e.g. credentials, from rc extension file through ui.config in hook

def hook(ui, repo, hooktype, node=None, source=None, **kwargs):
     username = ui.config('hgbuildbot', 'user', '')
     password = ui.config('hgbuildbot', 'passwd', '')

And the rc extension file is located at : /etc/mercurial-server/remote-hgrc.d/buildbot.rc

[hgbuildbot]
user = username
passwd = secret-password

With these setting in place, mercurial calls this hook and through ui.config we get the credentials, how can we do the same in Rhodecode: how to read from configruations from an rc extension file?

like image 532
javed Avatar asked Nov 20 '25 02:11

javed


1 Answers

Instead of separating code and configuration we ended up writing ansible playbook task that creates the rhodecode rcextension hook with configuration credentials - interpolation - because the separation of code and configuration was not an absolute necessity.

If it is a necessity then one possible option is to create json file which contains these credentials and read this file from the hook.

like image 198
javed Avatar answered Nov 22 '25 03:11

javed



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!