Improve configuration management in platform-api to use standard approach
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 71
- Forks
- 111
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 110
Description
Current Limitation
The configuration management in platform-api/src/config/config.go has several issues:
- Non-standard library dependency: Uses
github.com/kelseyhightower/envconfig, which is a third-party library that's not widely adopted as a standard - Environment variables only: All configuration is only read from environment variables, with no support for config files (YAML/JSON)
- Hardcoded overrides: Lines 97-98 hardcode database driver and path values, overriding the environment variable configuration:
settingInstance.Database.Driver = "sqlite3" settingInstance.Database.Path = "./data/api_platform.db"
This approach lacks flexibility and makes configuration management inconsistent.
Suggested Improvement
Replace the current configuration approach with a more standard and consistent solution:
-
Use a configuration file (e.g.,
config.yaml) for managing application configuration -
Support multiple configuration sources in order of precedence:
- Command-line flags (highest priority)
- Environment variables
- Configuration file (config.yaml)
- Default values (lowest priority)
-
Remove hardcoded values and ensure all configuration comes from the defined sources
Benefits
- More flexible configuration management
- Better alignment with Go ecosystem standards
- Easier to manage different environment configurations
- No hardcoded overrides that bypass configuration system
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with platform-api/src/config/config.go, including the hardcoded assignments on lines 97-98, and trace how github.com/kelseyhightower/envconfig currently loads settings. Define the intended precedence among flags, environment variables, config.yaml, and defaults before changing the design. Done means configuration comes from those defined sources without hardcoded overrides and supports the requested file formats.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100