Add JSON configuration support with environment variable interpolation#13
Merged
Add JSON configuration support with environment variable interpolation#13
Conversation
Co-authored-by: Yukaii <4230968+Yukaii@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Support json config
Add JSON configuration support with environment variable interpolation
Jun 5, 2025
Owner
|
@copilot Update the config under XDG_CONFIG_HOME/tailportal/config.json or ~/.config/tailportal/config.json then ~/.tailportal.json |
Co-authored-by: Yukaii <4230968+Yukaii@users.noreply.github.com>
Contributor
Author
Updated configuration paths to follow XDG Base Directory standards. The config now searches in order:
Documentation has been updated accordingly. Changes in commit 1f047ed. |
Owner
|
@copilot COuld you also add some tests for it |
Co-authored-by: Yukaii <4230968+Yukaii@users.noreply.github.com>
Contributor
Author
Added comprehensive unit tests for the configuration functionality. The test suite includes 14 test cases covering:
All tests pass successfully. Commit 78c506e. |
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.
This PR adds support for JSON-based configuration files in addition to the existing environment variable approach, addressing the need for more flexible configuration management.
Features Added
JSON Configuration Files
./tailportal.json(current directory)./.tailportal.json(current directory, hidden)~/.tailportal.json(home directory)Environment Variable Interpolation
$ENV_VAR_NAMEsyntax for environment variable interpolation{ "tsAuthKey": "$TS_AUTH_KEY", "pulumiPassphrase": "$PULUMI_CONFIG_PASSPHRASE", "vultrApiKey": "$VULTR_API_KEY", "googleProject": "my-project", "googleCredentials": "$GOOGLE_CREDENTIALS" }Backward Compatibility
Implementation Details
src/config.tsmodule with centralized configuration loading logicindex.tsto eliminate code duplication across all command actionsUsage Examples
Environment Variables (existing approach):
JSON Configuration:
Mixed approach with interpolation:
Fixes #12.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.