Coverage for watcher/api/config.py: 100%

9 statements  

« prev     ^ index     » next       coverage.py v7.8.2, created at 2025-06-17 12:22 +0000

1# -*- encoding: utf-8 -*- 

2# 

3# Licensed under the Apache License, Version 2.0 (the "License"); 

4# you may not use this file except in compliance with the License. 

5# You may obtain a copy of the License at 

6# 

7# http://www.apache.org/licenses/LICENSE-2.0 

8# 

9# Unless required by applicable law or agreed to in writing, software 

10# distributed under the License is distributed on an "AS IS" BASIS, 

11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 

12# implied. 

13# See the License for the specific language governing permissions and 

14# limitations under the License. 

15 

16from oslo_config import cfg 

17from watcher.api import hooks 

18 

19# Server Specific Configurations 

20# See https://pecan.readthedocs.org/en/latest/configuration.html#server-configuration # noqa 

21server = { 

22 'port': '9322', 

23 'host': '127.0.0.1' 

24} 

25 

26# Pecan Application Configurations 

27# See https://pecan.readthedocs.org/en/latest/configuration.html#application-configuration # noqa 

28acl_public_routes = ['/'] 

29if not cfg.CONF.api.get("enable_webhooks_auth"): 

30 acl_public_routes.append('/v1/webhooks/.*') 

31 

32app = { 

33 'root': 'watcher.api.controllers.root.RootController', 

34 'modules': ['watcher.api'], 

35 'hooks': [ 

36 hooks.ContextHook(), 

37 hooks.NoExceptionTracebackHook(), 

38 ], 

39 'static_root': '%(confdir)s/public', 

40 'enable_acl': True, 

41 'acl_public_routes': acl_public_routes, 

42} 

43 

44# WSME Configurations 

45# See https://wsme.readthedocs.org/en/latest/integrate.html#configuration 

46wsme = { 

47 'debug': cfg.CONF.get("debug") if "debug" in cfg.CONF else False, 

48} 

49 

50PECAN_CONFIG = { 

51 "server": server, 

52 "app": app, 

53 "wsme": wsme, 

54}