Skip to content

Add env override for Add/Manage License button#27779

Merged
AlexGaillard merged 37 commits into
mainfrom
alexg/cms-2721
Jul 10, 2026
Merged

Add env override for Add/Manage License button#27779
AlexGaillard merged 37 commits into
mainfrom
alexg/cms-2721

Conversation

@AlexGaillard

@AlexGaillard AlexGaillard commented Jun 24, 2026

Copy link
Copy Markdown
Member

Scope

What's changed:

  • A new env override LICENSE_KEY_MANAGEMENT_ENABLED has been added with default true
  • Setting this to false will disable the "Add/Manage License" button on the license page
  • This will also disable management of the license via the api
  • This change required an update of the @directus/license package, which has already been published with the change
  • Messaging for why management of license has been extended to account for both key in env and disallowed by env in both the "Manage License" button and the "Deactivate License" button

Potential Risks / Drawbacks

  • Changes to license manager cause some weird behavior

Tested Scenarios

  • Tested:

Manually tested across all these states and backed up by Claude

Before

  Post Patch Delete UI Disabled UI Message
source === null 204 403 - "You cannot manage license for the current license.” 403 - "You cannot manage license for the current license.” false null
source === ‘env’ 403 - "You cannot manage license for the current license.” 403 - "You cannot manage license for the current license.” 403 - "You cannot manage license for the current license.” true “Your license key is managed via an environment variable and can't be updated here.”
source === ‘settings’ 403 - "A license was already activated” 204 204 false null

After

  Post Patch Delete UI Disabled UI Message
source === null && LICENSE_KEY_MANAGEMENT_ENABLED === true 204 403 - "There is no active license to manage.” 403 - "There is no active license to manage.” false null
source === ‘env’ && LICENSE_KEY_MANAGEMENT_ENABLED === true 403 - "You cannot manage license for the current license.” 403 - "You cannot manage license for the current license.” 403 - "You cannot manage license for the current license.” true “Your license key is managed via an environment variable and can't be updated here.”
source === ‘settings’ && LICENSE_KEY_MANAGEMENT_ENABLED === true 403 - "A license was already activated” 204 204 false null
source === null && LICENSE_KEY_MANAGEMENT_ENABLED === false 403 - "You cannot manage license for the current license.” 403 - "You cannot manage license for the current license.” 403 - "You cannot manage license for the current license.” true “Management of your license key is disabled by your environment settings”
source === ‘env’ && LICENSE_KEY_MANAGEMENT_ENABLED === false 403 - "You cannot manage license for the current license.” 403 - "You cannot manage license for the current license.” 403 - "You cannot manage license for the current license.” true “Your license key is managed via an environment variable and can't be updated here.”
source === ‘settings’ && LICENSE_KEY_MANAGEMENT_ENABLED === false 403 - "You cannot manage license for the current license.” 403 - "You cannot manage license for the current license.” 403 - "You cannot manage license for the current license.” true “Management of your license key is disabled by your environment settings”

Review Notes / Questions

  • NA

Checklist

  • Added or updated tests
  • Documentation PR created here or not required
  • OpenAPI package PR created here or not required

Fixes cms-2721

@linear-code

linear-code Bot commented Jun 24, 2026

Copy link
Copy Markdown

CMS-2721

Comment thread api/src/services/server.ts Outdated
@AlexGaillard AlexGaillard marked this pull request as ready for review June 26, 2026 18:11

@ComfortablyCoding ComfortablyCoding left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

First pass review

  • Are there any E2E tests I should update? New ones should be added to back this behavior.
  • Should we document this? Yes

Comment thread .changeset/six-pears-shave.md Outdated
Comment thread api/src/license/manager.ts
Comment thread api/src/license/manager.ts Outdated
Comment thread app/src/modules/settings/routes/license/license.vue Outdated
Comment thread app/src/modules/settings/routes/license/license.vue
Comment thread app/src/modules/settings/routes/license/license.vue Outdated
@AlexGaillard AlexGaillard marked this pull request as draft June 30, 2026 19:28
@AlexGaillard AlexGaillard marked this pull request as ready for review June 30, 2026 21:14

@ComfortablyCoding ComfortablyCoding left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Second pass review

Comment thread tests/e2e/tests/license/rest-write.sb.test.ts Outdated
Comment thread .changeset/six-pears-shave.md Outdated
Comment thread api/src/license/manager.ts Outdated
Comment thread packages/env/src/constants/defaults.ts
@codecov

codecov Bot commented Jul 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 68.42105% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 68.40%. Comparing base (1626daf) to head (0954128).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #27779      +/-   ##
==========================================
- Coverage   68.41%   68.40%   -0.01%     
==========================================
  Files        2378     2379       +1     
  Lines      163968   163985      +17     
  Branches    15078    15082       +4     
==========================================
- Hits       112181   112178       -3     
- Misses      51787    51807      +20     
Flag Coverage Δ
api 57.38% <21.73%> (+<0.01%) ⬆️
app 76.94% <100.00%> (-0.02%) ⬇️
composables 83.70% <ø> (ø)
constants 4.69% <ø> (ø)
create-directus-extension 96.55% <ø> (ø)
create-directus-project 98.43% <ø> (ø)
env 99.74% <100.00%> (+<0.01%) ⬆️
errors 96.17% <ø> (ø)
extensions 35.63% <ø> (ø)
extensions-registry 95.43% <ø> (ø)
extensions-sdk 14.37% <ø> (ø)
format-title 100.00% <ø> (ø)
memory 100.00% <ø> (ø)
pressure 77.63% <ø> (ø)
release-notes-generator 80.91% <ø> (ø)
schema-builder 81.42% <ø> (ø)
sdk 33.28% <ø> (ø)
storage 92.00% <ø> (ø)
storage-driver-azure 73.33% <ø> (ø)
storage-driver-cloudinary 80.62% <ø> (ø)
storage-driver-gcs 66.95% <ø> (ø)
storage-driver-local 69.76% <ø> (ø)
storage-driver-s3 52.16% <ø> (ø)
storage-driver-supabase 67.25% <ø> (ø)
system-data 32.42% <ø> (ø)
update-check 55.67% <ø> (ø)
utils 91.72% <ø> (ø)
validation 43.78% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ComfortablyCoding ComfortablyCoding left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@AlexGaillard AlexGaillard merged commit 9f2f73a into main Jul 10, 2026
98 of 102 checks passed
@AlexGaillard AlexGaillard deleted the alexg/cms-2721 branch July 10, 2026 22:42
@github-actions github-actions Bot added this to the Next Release milestone Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants