Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PB-1083: Removed default icon set 'babs' from UNLISTED_ICON_SET #93

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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