Skip to content

Commit

Permalink
Compact code to inherit default_qgis_server_url from config generator…
Browse files Browse the repository at this point in the history
… config
  • Loading branch information
manisandro committed Dec 7, 2024
1 parent ae1f087 commit 7de889e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 25 deletions.
11 changes: 3 additions & 8 deletions src/config_generator/feature_info_service_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,9 @@ def config(self):
config['service'] = 'feature-info'

# additional service config
cfg_config = self.service_config.get('config', {})
if 'default_qgis_server_url' not in cfg_config:
# use default QGIS server URL from ConfigGenerator config
# if not set in service config
cfg_config['default_qgis_server_url'] = \
self.default_qgis_server_url

config['config'] = cfg_config
config['config'] = self.service_config.get('config', {})
# Use default_qgis_server_url from ConfigGenerator config if not explicitly set
config['default_qgis_server_url'] = config.get('default_qgis_server_url', self.default_qgis_server_url)

resources = OrderedDict()
config['resources'] = resources
Expand Down
12 changes: 3 additions & 9 deletions src/config_generator/legend_service_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,9 @@ def config(self):
config = super().config()

# additional service config
cfg_config = self.service_config.get('config', {})
if 'default_qgis_server_url' not in cfg_config:
# use default QGIS server URL from ConfigGenerator config
# if not set in service config
cfg_config['default_qgis_server_url'] = \
self.default_qgis_server_url

self.legend_images_path = cfg_config['legend_images_path']
config['config'] = cfg_config
config['config'] = self.service_config.get('config', {})
# Use default_qgis_server_url from ConfigGenerator config if not explicitly set
config['default_qgis_server_url'] = config.get('default_qgis_server_url', self.default_qgis_server_url)

resources = OrderedDict()
config['resources'] = resources
Expand Down
11 changes: 3 additions & 8 deletions src/config_generator/ogc_service_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,9 @@ def config(self):
config = super().config()

# additional service config
cfg_config = self.service_config.get('config', {})
if 'default_qgis_server_url' not in cfg_config:
# use default QGIS server URL from ConfigGenerator config
# if not set in service config
cfg_config['default_qgis_server_url'] = \
self.default_qgis_server_url

config['config'] = cfg_config
config['config'] = self.service_config.get('config', {})
# Use default_qgis_server_url from ConfigGenerator config if not explicitly set
config['default_qgis_server_url'] = config.get('default_qgis_server_url', self.default_qgis_server_url)

resources = OrderedDict()
config['resources'] = resources
Expand Down

0 comments on commit 7de889e

Please sign in to comment.