Skip to content

feat: add configuration file support for API key management #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

lhr000lhr
Copy link

  • Add config.json and config.template.json for secure API key storage
  • Update DefaultEnvInitializer to load API keys from JSON config file
  • Add Config struct for JSON decoding with proper error handling
  • Include fallback mechanism when config file is missing
  • Update .gitignore to prevent accidental commit of sensitive config
  • Update README with clear setup instructions for both config file and direct code approaches
  • Improve security by separating API keys from source code

BREAKING CHANGE: API key is now loaded from config.json instead of hardcoded value

- Introduced `config.json` for API key storage, with a template file `config.template.json`.
- Updated `DefaultEnvInitializer.swift` to load API keys from the configuration file.
- Enhanced README with instructions for using the configuration file and emphasized the importance of not committing sensitive information.
- Added background mode support in `Info.plist` for audio processing.
- Updated `.gitignore` to include `config.json` to prevent accidental commits.
Copy link
Collaborator

@chen-argmax chen-argmax left a comment

Choose a reason for hiding this comment

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

thanks for the change! lgtm just a couple of fields remove

@@ -465,6 +469,7 @@
MACOSX_DEPLOYMENT_TARGET = 14.2;
MARKETING_VERSION = 0.0.1;
PRODUCT_BUNDLE_IDENTIFIER = "com.argmaxinc.example.Playground${DEVELOPMENT_TEAM}";
"PRODUCT_BUNDLE_IDENTIFIER[sdk=iphoneos*]" = com.argmaxinc.example.Playground;
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this required?

Copy link
Author

Choose a reason for hiding this comment

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

Yeah, Xcode generated this part

@@ -490,7 +495,7 @@
DEAD_CODE_STRIPPING = YES;
DEPLOYMENT_POSTPROCESSING = NO;
DEVELOPMENT_ASSET_PATHS = "\"Playground/Preview Content\"";
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = 2A7SXV3WJH;
Copy link
Collaborator

Choose a reason for hiding this comment

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

please remove your development team :)

@@ -517,6 +522,7 @@
MACOSX_DEPLOYMENT_TARGET = 14.2;
MARKETING_VERSION = 0.0.1;
PRODUCT_BUNDLE_IDENTIFIER = "com.argmaxinc.example.Playground${DEVELOPMENT_TEAM}";
"PRODUCT_BUNDLE_IDENTIFIER[sdk=iphoneos*]" = com.argmaxinc.example.Playground;
Copy link
Collaborator

Choose a reason for hiding this comment

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

ditto

README.md Outdated
```json
{
"apiKey": "your_actual_api_key_here",
"huggingFaceToken": null
Copy link
Collaborator

Choose a reason for hiding this comment

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

we just open sourced our huggingface repo, so huggingfacetoken is no longer needded, we can remove this field

Copy link
Author

Choose a reason for hiding this comment

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

yea I also removed huggingFaceToken form the PlainTextAPIKeyProvider now

@lhr000lhr lhr000lhr reopened this Aug 6, 2025
…ration

- Updated `README.md` to reflect the removal of `huggingFaceToken` from the API key configuration.
- Modified `DefaultEnvInitializer.swift` to eliminate references to `huggingFaceToken` when initializing the API key provider.
- Adjusted `config.template.json` to remove `huggingFaceToken` from the template structure.
- Cleared `DEVELOPMENT_TEAM` entries in `project.pbxproj` for better configuration management.
@lhr000lhr lhr000lhr requested a review from chen-argmax August 6, 2025 05:10
Copy link
Collaborator

@chen-argmax chen-argmax left a comment

Choose a reason for hiding this comment

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

thanks for the contribution!

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