Simplify licensing: make region optional and support bare tokens#539
Merged
Conversation
Registration now issues only an auth token rather than a full dotenv license block. Update the init workflow and license handling to accept a bare token while remaining backwards compatible with the legacy W24TECHREAD_AUTH_TOKEN/W24TECHREAD_AUTH_REGION format. - Make the region optional on the License model (it is never used for the API connection, only the token is sent in the auth header) and reject empty tokens. - Teach parse_license_text to accept a bare token in addition to the legacy dotenv block. - Only persist the region to the license file when one is present. - Treat a missing region as optional in env-var discovery. - Reword the init CLI prompts to ask for a token, and update the invalid license message. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012mTmqkybmwU1e19ePJs4qC
Werk24 no longer offers a trial license; users sign up for a pay-as-you-go license instead. Rename the setting and init workflow references accordingly (the signup URL value is unchanged). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012mTmqkybmwU1e19ePJs4qC
Users can sign up for any type of license, so drop the pay-as-you-go specific wording in favour of a generic signup flow. Rename the setting to signup_url and the helper to sign_up_for_license (signup URL value unchanged). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012mTmqkybmwU1e19ePJs4qC
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012mTmqkybmwU1e19ePJs4qC
jmtts
approved these changes
Jul 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR modernizes the licensing system by making the region field optional and adding support for bare token format (as issued during registration), while maintaining backwards compatibility with legacy dotenv-style license files.
Key Changes
regionfield in theLicensemodel is now optional (Optional[str] = None), reflecting that modern registration only issues tokens without regionsparse_license_text()now supports two formats:W24TECHREAD_AUTH_TOKEN=...(with optionalW24TECHREAD_AUTH_REGION=...)@field_validatorto ensure tokens are not empty or whitespace-onlyTOKEN_ENV_KEYandREGION_ENV_KEYconstants to reduce duplication and improve maintainabilitytrial_license_urltosignup_urlinSettingsclassImplementation Details
find_license_in_envs()function now only requires the token environment variable to be set (region is optional)parse_license_text()intelligently detects format by checking for the presence ofTOKEN_ENV_KEYin the inputhttps://claude.ai/code/session_012mTmqkybmwU1e19ePJs4qC