Skip to content

Commit

Permalink
override default integer/float formatting with environment variables (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
chang authored and arikfr committed Jan 20, 2019
1 parent 8bc8e2d commit b91d4bd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions redash/handlers/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,13 @@ def date_format_config():
}


def number_format_config():
return {
'integerFormat': current_org.get_setting('integer_format'),
'floatFormat': current_org.get_setting('float_format'),
}


def client_config():
if not current_user.is_api_user() and current_user.is_authenticated:
client_config = {
Expand Down Expand Up @@ -226,6 +233,7 @@ def client_config():
'basePath': base_href()
})
client_config.update(date_format_config())
client_config.update(number_format_config())

return client_config

Expand Down
4 changes: 4 additions & 0 deletions redash/settings/organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
SAML_LOGIN_ENABLED = SAML_METADATA_URL != ""

DATE_FORMAT = os.environ.get("REDASH_DATE_FORMAT", "DD/MM/YY")
INTEGER_FORMAT = os.environ.get("REDASH_INTEGER_FORMAT", "0,0")
FLOAT_FORMAT = os.environ.get("REDASH_FLOAT_FORMAT", "0,0.00")

JWT_LOGIN_ENABLED = parse_boolean(os.environ.get("REDASH_JWT_LOGIN_ENABLED", "false"))
JWT_AUTH_ISSUER = os.environ.get("REDASH_JWT_AUTH_ISSUER", "")
Expand All @@ -35,6 +37,8 @@
"auth_saml_metadata_url": SAML_METADATA_URL,
"auth_saml_nameid_format": SAML_NAMEID_FORMAT,
"date_format": DATE_FORMAT,
"integer_format": INTEGER_FORMAT,
"float_format": FLOAT_FORMAT,
"auth_jwt_login_enabled": JWT_LOGIN_ENABLED,
"auth_jwt_auth_issuer": JWT_AUTH_ISSUER,
"auth_jwt_auth_public_certs_url": JWT_AUTH_PUBLIC_CERTS_URL,
Expand Down

0 comments on commit b91d4bd

Please sign in to comment.