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

Generate environment variable documentation: exclude specific variables #83

Open
stevenbal opened this issue Oct 10, 2024 · 1 comment
Labels
triage Triage means the team has not yet refined this issue.

Comments

@stevenbal
Copy link
Contributor

Question from @sergei-maertens via slack:

https://odrc.readthedocs.io/en/latest/installation/config.html -> this is auto-generated via the management command from OAF. is there a way to exclude some settings? e.g. we don't use django.contrib.sites so I don't want SITE_ID to be mentioned. We're also not supporting outgoing email for now

We could add something like --exclude-var to the management command (https://github.com/maykinmedia/open-api-framework/blob/main/open_api_framework/management/commands/generate_envvar_docs.py#L32-L36) to exclude individual variables/settings

@sergei-maertens would this work for you?

@stevenbal stevenbal added the triage Triage means the team has not yet refined this issue. label Oct 10, 2024
@sergei-maertens
Copy link
Member

I suppose, though it's not ideal since whenever OAF is updated in a project, I then have to check which settings were added/changed and update my shell scripts/commands accordingly.

Personally I'd much rather have a custom Sphinx directive akin to sphinx.ext.autodoc so that I can write my documentation based on an allow list:

Available configuration parameters
==================================

.. entire group with all settings within group
:config_group:`Required settings`
    :members:

.. use a group, but apply allowlist to only document specified members
:config_group:`Cross Origin resource sharing`
    :members: CORS_ALLOW_ALL_ORIGINS,CORS_ALLOWED_ORIGINS

.. use a group, but exclude some members (e.g. it's available but considered dangerous -> treat as private API)
:config_group:`Cross Origin resource sharing`
    :exclude: CORS_ALLOW_ALL_ORIGINS

.. document individual parameters, allowlist basis
Special snowflake parameters
----------------------------

.. use documentation from `config` helper
:config_param:`DISABLE_2FA`

.. override baked in documentation
:config_param:`DISABLE_2FA`: Custom documentation snippet to override whatever is specified in `config`.
    .. ability to override the default, in case it was overridden (e.g. via `os.environ.setdefault("...", ...)`)
    :default: 1  

This closely matches my thoughts about django-setup-configuration setup/docs too, so tagging @pi-sigma for completeness sake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage Triage means the team has not yet refined this issue.
Projects
Status: Triage
Development

No branches or pull requests

2 participants