Add deploy hook for dcc_api_key

Plus small refactoring