Skip to content

feat: make feed license configurable via environment variable#616

Merged
regulartim merged 5 commits intointelowlproject:developfrom
opbot-xd:feature/configurable-feed-license-v2
Dec 17, 2025
Merged

feat: make feed license configurable via environment variable#616
regulartim merged 5 commits intointelowlproject:developfrom
opbot-xd:feature/configurable-feed-license-v2

Conversation

@opbot-xd
Copy link
Copy Markdown
Contributor

feat: make feed license configurable. Closes #599

Description

This PR makes the feed license configurable via environment variable, allowing self-hosted GreedyBear instances to use different licenses or none at all.

Changes:

  • Moved FEEDS_LICENSE from hardcoded constant to optional environment variable.
  • Updated all API views to conditionally include license field only when configured.
  • Modified tests to handle both scenarios (with/without license).
  • Added configuration option to env_file_template with documentation.

Implementation Details:

  • When FEEDS_LICENSE is set, it's included in all API responses (feeds, enrichment, etc.).
  • When not set, the license field is completely omitted from responses.
  • Backward compatible: existing deployments can set the variable to maintain current behavior.

Related issues

Closes #599

Type of change

  • New feature (non-breaking change which adds functionality).

Checklist

  • I have read and understood the rules about how to Contribute to this project.
  • The pull request is for the branch develop.
  • I have added documentation of the new features.
  • Linters (Black, Flake, Isort) gave 0 errors.
  • I have added tests for the feature/bug I solved. All the tests (new and old ones) gave 0 errors.
  • If changes were made to an existing model/serializer/view, the docs were updated and regenerated (check CONTRIBUTE.md).
  • If the GUI has been modified:
    • I have a provided a screenshot of the result in the PR.
    • I have created new frontend tests for the new component or updated existing ones.

- Move FEEDS_LICENSE from hardcoded constant to optional environment variable
- Update settings.py to read FEEDS_LICENSE from environment
- Add FEEDS_LICENSE configuration to env_file_template with example
- Modify API views to only include license field when FEEDS_LICENSE is set
- Update tests to handle both scenarios (with/without license configured)
- This allows self-hosted instances to use different licenses or none at all

Fixes intelowlproject#599
…e_settings compatibility

The @override_settings decorator only works when accessing settings through django.conf.settings, not with direct imports. This fixes test failures where FEEDS_LICENSE was imported directly from greedybear.settings.

Changes:
- api/views/utils.py: Import settings and use settings.FEEDS_LICENSE
- api/views/command_sequence.py: Import settings and use settings.FEEDS_LICENSE
- api/views/cowrie_session.py: Import settings and use settings.FEEDS_LICENSE
- tests/test_views.py: Import settings and use settings.FEEDS_LICENSE

This ensures tests with @override_settings(FEEDS_LICENSE="...") work correctly.
@opbot-xd
Copy link
Copy Markdown
Contributor Author

Apologies for the confusion with the previous PR #609 . I realized I had mistakenly branched off main instead of develop, which caused the commit history to become messy.

To fix this, I reset my local branch to match develop and cherry-picked my specific feature commits onto it. This ensures the history is now clean, linear, and strictly contains the changes for this feature on top of the correct base branch.

@regulartim regulartim merged commit 367b20c into intelowlproject:develop Dec 17, 2025
5 checks passed
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.

2 participants