Skip to content

Commit

Permalink
Merge pull request #93 from geoadmin/feat-PB-1083-correct-default-unl…
Browse files Browse the repository at this point in the history
…isted-value

PB-1083: Removed default icon set 'babs' from UNLISTED_ICON_SET
  • Loading branch information
sami-nouidri-swisstopo authored Nov 15, 2024
2 parents 416a337 + c7caeaf commit 87e5d28
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .env.local
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
ALLOWED_DOMAINS=.*
ALLOWED_DOMAINS=.*
UNLISTED_ICON_SETS=
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,4 @@ The service is configured by Environment Variable:
| WSGI_TIMEOUT | `5` | WSGI timeout. |
| GUNICORN_TMPFS_DIR | `None` |The working directory for the gunicorn workers. |
| WSGI_WORKERS | `2` | The number of workers per CPU. |
| UNLISTED_ICON_SETS | `'babs'`| Comma separated list of icon set to un-list. Those sets won't be listed in the /sets endpoint. |
| UNLISTED_ICON_SETS | | Comma separated list of icon set to un-list. Those sets won't be listed in the /sets endpoint. |
6 changes: 6 additions & 0 deletions app/helpers/icons.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,9 @@ def get_icon_template_url(base_url='', with_color=True):
color_part = "-{r},{g},{b}"
return f"{get_icon_set_template_url(base_url)}/icons/{{icon_name}}" \
f"@{{icon_scale}}{color_part}.png"


def split_and_clean_string(input_string):
split_string = input_string.split(',')
cleaned_split_string = [string_item for string_item in split_string if string_item]
return cleaned_split_string
6 changes: 5 additions & 1 deletion app/settings.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import os
from pathlib import Path

from app.helpers.icons import split_and_clean_string

BASE_DIR = Path(__file__).resolve(strict=True).parent.parent
ENV_FILE = os.getenv('ENV_FILE', f'{BASE_DIR}/.env.local')
if ENV_FILE and Path(ENV_FILE).exists():
Expand All @@ -15,7 +17,9 @@
)

COLORABLE_ICON_SETS = ['default']
UNLISTED_ICON_SETS = os.environ.get('UNLISTED_ICON_SETS', 'babs').split(',')

UNLISTED_ICON_SETS = split_and_clean_string(os.environ.get('UNLISTED_ICON_SETS', ''))

ICON_SET_LANGUAGE = {'babs-v2-de': 'de', 'babs-v2-fr': 'fr', 'babs-v2-it': 'it'}
DEFAULT_COLOR = {"r": '255', "g": '0', "b": '0'}
DEFAULT_ICON_SIZE = 48
Expand Down

0 comments on commit 87e5d28

Please sign in to comment.