Skip to content

Commit

Permalink
Merge pull request #285 from OpenHistoricalMap/staging
Browse files Browse the repository at this point in the history
Updates from staging
  • Loading branch information
Rub21 authored Apr 10, 2024
2 parents d1977fc + 047519d commit 1583d5f
Show file tree
Hide file tree
Showing 29 changed files with 1,700 additions and 719 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/frontend-nominatim.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
if: github.ref == 'refs/heads/staging'
uses: allenevans/[email protected]
with:
NOMINATIM_API: 'https://nominatim-api-staging.openhistoricalmap.org/'
NOMINATIM_API: 'https://nominatim-api.staging.openhistoricalmap.org/'
NOMINATIM_BUCKET: 'nominatim-staging.openhistoricalmap.org'
CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.STAGING_NOMINATIM_CLOUDFRONT_ID }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/frontend-overpass.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
if: github.ref == 'refs/heads/staging'
uses: allenevans/[email protected]
with:
OVERPASS_API: overpass-api-staging.openhistoricalmap.org
OVERPASS_API: overpass-api.staging.openhistoricalmap.org
OVERPASS_BUCKET: overpass-turbo-staging.openhistoricalmap.org
CLOUDFRONT_DISTRIBUTION_ID: ${{ secrets.STAGING_OVERPASS_CLOUDFRONT_ID }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/frontend-tasking-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
uses: allenevans/[email protected]
with:
TM_APP_BASE_URL: https://tasks-staging.openhistoricalmap.org
TM_APP_API_URL: https://staging-tm-api.openhistoricalmap.org
TM_APP_API_URL: https://tm-api.staging.openhistoricalmap.org
TM_APP_API_VERSION: v2
TM_ORG_NAME: OpenHistoricalMap
TM_ORG_CODE: OHM
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ values.dev.yaml
secrets
tegola
envs/.env.tiler
envs/.env.web
envs/.env.web
config.toml
10 changes: 9 additions & 1 deletion images/tiler-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,16 @@ RUN rm -rf /var/cache/apk/* \

RUN ln -s /opt/tegola /usr/bin/tegola

COPY ./config /opt/config/
COPY build_config.py /opt/
RUN mkdir /opt/tegola_config
RUN cd /opt/ && python build_config.py \
--template config/config.template.toml \
--providers config/providers \
--output /opt/tegola_config/config.toml

# Copy config and exec files
COPY ./config/config.toml /opt/tegola_config/config.toml
# COPY ./config/config.toml /opt/tegola_config/config.toml
COPY ./tile2bounds.py .
COPY ./start.sh .
COPY ./expire-watcher.sh .
Expand Down
36 changes: 36 additions & 0 deletions images/tiler-server/build_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import os
import argparse
parser = argparse.ArgumentParser(description='Merge TOML files into a configuration file.')
parser.add_argument('--template', default='config/config.template.toml', help='Path to the configuration template file.')
parser.add_argument('--providers', default='config/providers', help='Directory containing provider TOML files.')
parser.add_argument('--output', default='config/config.toml', help='Output configuration file path.')
args = parser.parse_args()

config_template_file = args.template
providers_dir = args.providers
output_file_path = args.output
toml_files = [file for file in os.listdir(providers_dir) if file.endswith(".toml")]

# Read TOML files
new_configs = {}
for toml_file in toml_files:
dir_toml_file = os.path.join(providers_dir, toml_file)
with open(dir_toml_file, "r") as file:
new_configs[dir_toml_file] = file.read()

with open(config_template_file, "r") as main_file:
content = main_file.read()

# Replace the content of main.toml with the content read from other TOML files
for toml_file, new_config in new_configs.items():
print(f"Copy {toml_file} to config.toml")
section_header = "[['{}']]".format(toml_file.replace("config/", ""))
indentation_level = content.find(section_header)
if indentation_level != -1:
# Find the appropriate number of tabs or spaces for indentation
preceding_newline = content.rfind('\n', 0, indentation_level)
indentation = content[preceding_newline + 1:indentation_level]
content = content.replace(section_header, new_config.replace("\n", "\n" + indentation))

with open(output_file_path, "w") as output_file:
output_file.write(content)
Loading

0 comments on commit 1583d5f

Please sign in to comment.