Recently working on some open source projects:
Usually deploy projects in the company, because Git仓库
belongs to 私有
, so there are configuration files based on 不同环境
, config-template.json
, config-onlone.json
and so on. When deploying, just replace these files with the deployment script.
But if you are working on an open source project, the configuration file cannot be submitted to the repository. This cannot be directly replaced.
My current approach is to write the configuration file on the deployment server, and then replace it with the official configuration file during deployment. But because the configuration files are placed on the server, it feels difficult to maintain, especially those with more configuration items. If there are changes, you have to go to the server to modify them, which is quite troublesome.
I wonder if you have any more convenient way to maintain these configuration files? Thank you everyone
Submit a configuration file in the same format as the official one to the code repository, such as the following
config-template.json
When reading the program, you can first determine whether there is config.json. If there is, use it. If not, an error will be reported.
config.json is the configuration of the official environment and cannot be submitted online
Deployed with ansible.