Document NetBox configuration approach with environment variables and third-party libraries #11542

Closed
opened 2025-12-29 21:46:36 +01:00 by adam · 0 comments
Owner

Originally created by @jnovinger on GitHub (Aug 29, 2025).

Originally assigned to: @jnovinger on GitHub.

Change Type

Addition

Area

Configuration

Proposed Changes

Add guidance explaining NetBox's configuration approach and why environment variables don't work as expected with third-party libraries like django-storages. Many Django libraries expect to use environment variable patterns, but NetBox's explicit configuration approach might affect how these libraries function.

Issue Context: Users following third-party library documentation (for example in #20184) expect environment variables to be automatically detected. This leads to confusion when standard patterns don't work as documented.

Documentation Updates Needed:

  1. In docs/configuration/index.md: explain NetBox's explicit configuration approach:

    • NetBox uses explicit Python configuration rather than environment variable detection
    • Benefits: Clear configuration, version control, explicit parameter definition
    • Impacts: Third-party libraries that rely on automatic environment variable detection require explicit configuration
  2. Environment Variable Usage Patterns: Document how to use environment variables in NetBox:

    # Explicitly reading environment variables when needed
    import os
    
    SECRET_KEY = os.environ.get('NETBOX_SECRET_KEY')
    
    # Third-party library configuration requires explicit parameter passing
    STORAGES = {
        'staticfiles': {
            'BACKEND': 'storages.backends.s3.S3Storage',
            'OPTIONS': {
                'bucket_name': os.environ.get('AWS_STORAGE_BUCKET_NAME'),
              'location': 'static/',
            }
        }
    }
    
  3. Common Third-Party Integration Gotchas: Document that libraries expecting automatic environment variable detection need explicit configuration in NetBox context

This addresses recurring support questions about why documented patterns from Django libraries don't work in NetBox and provides clear guidance on NetBox's configuration approach.

Originally created by @jnovinger on GitHub (Aug 29, 2025). Originally assigned to: @jnovinger on GitHub. ### Change Type Addition ### Area Configuration ### Proposed Changes Add guidance explaining NetBox's configuration approach and why environment variables don't work as expected with third-party libraries like `django-storage`s. Many Django libraries expect to use environment variable patterns, but NetBox's explicit configuration approach might affect how these libraries function. Issue Context: Users following third-party library documentation (for example in #20184) expect environment variables to be automatically detected. This leads to confusion when standard patterns don't work as documented. Documentation Updates Needed: 1. In `docs/configuration/index.md`: explain NetBox's explicit configuration approach: - NetBox uses explicit Python configuration rather than environment variable detection - Benefits: Clear configuration, version control, explicit parameter definition - Impacts: Third-party libraries that rely on automatic environment variable detection require explicit configuration 2. Environment Variable Usage Patterns: Document how to use environment variables in NetBox: ```py # Explicitly reading environment variables when needed import os SECRET_KEY = os.environ.get('NETBOX_SECRET_KEY') # Third-party library configuration requires explicit parameter passing STORAGES = { 'staticfiles': { 'BACKEND': 'storages.backends.s3.S3Storage', 'OPTIONS': { 'bucket_name': os.environ.get('AWS_STORAGE_BUCKET_NAME'), 'location': 'static/', } } } ``` 3. Common Third-Party Integration Gotchas: Document that libraries expecting automatic environment variable detection need explicit configuration in NetBox context This addresses recurring support questions about why documented patterns from Django libraries don't work in NetBox and provides clear guidance on NetBox's configuration approach.
adam added the status: acceptedtype: documentation labels 2025-12-29 21:46:36 +01:00
adam closed this issue 2025-12-29 21:46:36 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#11542