Feat: Move key.txt to auth_profiles for easier Docker management (Fixes #216)#235
Merged
CJackHwang merged 1 commit intoCJackHwang:mainfrom Sep 5, 2025
Merged
Conversation
CJackHwang
approved these changes
Sep 5, 2025
Owner
|
感谢您的贡献 |
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 pull request resolves issue #216 by relocating the
key.txtAPI key file from the project root into theauth_profiles/directory.The primary motivation for this change is to simplify data persistence when using Docker. It allows the entire
auth_profilesdirectory, which contains session data and now the API keys, to be managed by a single named volume. This improves containerization and makes configuration more intuitive.Changes Implemented
api_utils/auth_utils.py: TheKEY_FILE_PATHvariable was updated to point to the new location (auth_profiles/key.txt). Logic was also added to ensure theauth_profilesdirectory is created automatically if it doesn't exist.api_utils/routes.py: The API key management endpoints (add_api_key,delete_api_key) were refactored to use the centralizedKEY_FILE_PATHfromauth_utils, improving code consistency.Testing Results
The feature was thoroughly tested on Windows using PowerShell to verify its functionality.
Test 1: Initialization
key.txt.key.txtwas correctly created inauth_profiles/, and no file was created in the root directory.Test 2: Authentication with a Valid Key
my-test-key-123toauth_profiles/key.txtand restarted the server.curlcommand was executed and returned a200 OKstatus, confirming successful authentication.Command: