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

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?