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

Introduce FLEXMEASURES_JSON_COMPACT setting #1090

Merged
merged 2 commits into from
Jun 10, 2024

Conversation

nhoening
Copy link
Contributor

@nhoening nhoening commented Jun 10, 2024

Description

Happening in a move to deprecate JSONIFY_PRETTYPRINT_REGULAR.
We saw this deprecation warning in our server logs a lot, so it's good to move on from it.

The new setting is so we can still control it (i.e. in production you might want to read nicely).

Per default, the setting is Trueas it saves on IO volume. It is only False for development. Should it also be False during testing?

How to test

In a development environment, the default should be to not compact the JSON:

± curl -H "Content-Type: application/json" localhost:5000/api/ping
{
  "message": "The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.",
  "status": 404
}

We can enforce compact JSON:

± export FLEXMEASURES_JSON_COMPACT=True; flexmeasures run

± curl -H "Content-Type: application/json" localhost:5000/api/ping
{"message":"The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.","status":404}

And the other way around:

± export FLEXMEASURES_JSON_COMPACT=False; flexmeasures run

± curl -H "Content-Type: application/json" localhost:5000/api/ping
{
  "message": "The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.",
  "status": 404
}

Remember to unset this in your bash session:

± unset FLEXMEASURES_JSON_COMPACT

…SONIFY_PRETTYPRINT_REGULAR

Signed-off-by: Nicolas Höning <nicolas@seita.nl>
@nhoening nhoening requested a review from nrozanov June 10, 2024 12:43
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
@nhoening nhoening merged commit 695ae41 into main Jun 10, 2024
9 checks passed
@nhoening nhoening deleted the deprecation/JSONIFY_PRETTYPRINT_REGULAR branch June 10, 2024 14:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants