Skip to content

Load config SUPER_USER_CHAPTER_NAME as a string.

Jimmy Cuadra requested to merge jimmycuadra/super-user-chapter-name-type into dev

@DSASanFrancisco/portal-members

SUMMARY

The database configuration was incorrectly attempting to parse the environment variable as an int, but it's supposed to be a string. This will make the app crash on boot if a valid value is present in this environment variable:

Traceback (most recent call last):
  File "/usr/src/app/config/lib.py", line 142, in validate
    return as_type(value) if convert is None else convert(value)
ValueError: invalid literal for int() with base 10: 'San Francisco DSA'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "flask_app.py", line 7, in <module>
    from config import LOGGING_ROOT_LEVEL
  File "/usr/src/app/config/__init__.py", line 6, in <module>
    from .database_config import *  # NOQA
  File "/usr/src/app/config/database_config.py", line 19, in <module>
    SUPER_USER_CHAPTER_NAME: int = from_env.get_int('SUPER_USER_CHAPTER_NAME', 'Local Chapter')
  File "/usr/src/app/config/lib.py", line 194, in get_int
    return self.get_as(int, key, or_else, convert)
  File "/usr/src/app/config/lib.py", line 168, in get_as
    return self.validate(as_type, key, result, or_else, convert)
  File "/usr/src/app/config/lib.py", line 146, in validate
    ) from e
config.lib.ConfigValueError: Could not load config key 'SUPER_USER_CHAPTER_NAME' as int: invalid literal for int() with base 10: 'San Francisco DSA'
Edited by Jimmy Cuadra

Merge request reports