git - How to deal with sensitive configuration items more conveniently when deploying open source projects?
PHP中文网
PHP中文网 2017-05-02 09:42:08
0
2
614

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

PHP中文网
PHP中文网

认证0级讲师

reply all(2)
黄舟

Submit a configuration file in the same format as the official one to the code repository, such as the following
config-template.json

{
    "mysql":{
        "host":"mysql_host",
        "port":3306
    }
}

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.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template