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

Document Environment Variables #2338

Closed
wants to merge 1 commit into from

Conversation

TheoLechemia
Copy link

Small contribution on documentation.
See #1694
No sure if it's the way you want to do it.. tell me

@samuelhwilliams
Copy link
Contributor

samuelhwilliams commented Jul 21, 2024

Thanks for the suggested improvement to document env var configuration on Flask-Admin; I agree this is something we're missing at the moment.

We've just removed env var configuration for theming (swatch, fluid layout) and move it to a Theme config object passed to the admin instance. It looks like we still have three possible env vars: ADMIN_RAISE_ON_INTEGRITY_ERROR, ADMIN_RAISE_ON_VIEW_EXCEPTION and FLASK_ADMIN_SEARCH_SIZE_MAX. It would be good to add documentation for those. I think it makes sense to flag these at the bottom of 'introduction.rst' rather than hiding them in 'advanced.rst'.

If you wanted to update the PR I'd be very grateful - if not I'll try to get around to it soon.

@samuelhwilliams samuelhwilliams self-assigned this Jul 21, 2024

This section list settings supported in the current release

FLASK_ADMIN_SWATCH
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version 2 doesn't have this anymore.

Theme for bootswatch in order to customize you UI. See https://bootswatch.com/
Example : FLASK_ADMIN_SWATCH = "simplex"

FLASK_ADMIN_FLUID_LAYOUT
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Version 2 doesn't have this anymore.

@hasansezertasan
Copy link
Member

Thanks for the suggested improvement to document env var configuration on Flask-Admin; I agree this is something we're missing at the moment.

We've just removed env var configuration for theming (swatch, fluid layout) and move it to a Theme config object passed to the admin instance. It looks like we still have three possible env vars: ADMIN_RAISE_ON_INTEGRITY_ERROR, ADMIN_RAISE_ON_VIEW_EXCEPTION and FLASK_ADMIN_SEARCH_SIZE_MAX. It would be good to add documentation for those. I think it makes sense to flag these at the bottom of 'introduction.rst' rather than hiding them in 'advanced.rst'.

If you wanted to update the PR I'd be very grateful - if not I'll try to get around to it soon.

Looks like we have a lot more...

{% macro form_js() %}
{% if config.MAPBOX_MAP_ID %}
<script>
window.MAPBOX_MAP_ID = "{{ config.MAPBOX_MAP_ID }}";
{% if config.MAPBOX_ACCESS_TOKEN %}
window.MAPBOX_ACCESS_TOKEN = "{{ config.MAPBOX_ACCESS_TOKEN }}";
{% endif %}
{% if config.DEFAULT_CENTER_LAT and config.DEFAULT_CENTER_LONG %}
window.DEFAULT_CENTER_LAT = "{{ config.DEFAULT_CENTER_LAT }}";
window.DEFAULT_CENTER_LONG = "{{ config.DEFAULT_CENTER_LONG }}";
{% endif %}
</script>
<script src="{{ admin_static.url(filename='vendor/leaflet/leaflet.js', v='1.0.2') }}"></script>
<script src="{{ admin_static.url(filename='vendor/leaflet/leaflet.draw.js', v='0.4.6') }}"></script>
{% if config.MAPBOX_SEARCH %}
<script>
window.MAPBOX_SEARCH = "{{ config.MAPBOX_SEARCH }}";
</script>
<script src="https://maps.googleapis.com/maps/api/js?v=3&libraries=places&key={{ config.get('GOOGLE_MAPS_API_KEY') }}"></script>
{% endif %}
{% endif %}
<script src="{{ admin_static.url(filename='vendor/bootstrap-daterangepicker/daterangepicker.js', v='1.3.22') }}"></script>
{% if editable_columns %}
<script src="{{ admin_static.url(filename='vendor/x-editable/js/bootstrap4-editable.min.js', v='1.5.1.1') }}"></script>
{% endif %}
<script src="{{ admin_static.url(filename='admin/js/form.js', v='1.0.1') }}"></script>
{% endmacro %}

@hasansezertasan hasansezertasan changed the title doc on parameters Document Environment Variables Jul 22, 2024
@samuelhwilliams
Copy link
Contributor

🥲 We should have a consistent namespace for all of these, too.

@TheoLechemia
Copy link
Author

Maybe I would take a look when the 2.0 will be almost stabilised ?
I see there is still a MAPBOX_MAP_ID which is discuss here : #2034

@samuelhwilliams
Copy link
Contributor

Thanks for flagging #2034 - agree that we should fix that interface. I've assigned myself to it and will think about what we want to do there.

For now I'm going to close this PR as I'll put one up shortly that rationalises all of the config variables under a FLASK_ADMIN_ namespace and adds some documentation.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

None yet

3 participants