This is an automated email from the ASF dual-hosted git repository. wenming pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-apisix.git
The following commit(s) were added to refs/heads/master by this push: new e64ed39 doc: add English doc `doc/profile-cn.md` (#1192) e64ed39 is described below commit e64ed39eaeb6b5f63494b237e04e0c58aa056808 Author: Ayeshmantha Perera <akayeshman...@apache.org> AuthorDate: Wed Mar 4 02:42:56 2020 +0100 doc: add English doc `doc/profile-cn.md` (#1192) --- doc/profile.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/doc/profile.md b/doc/profile.md new file mode 100644 index 0000000..398e77c --- /dev/null +++ b/doc/profile.md @@ -0,0 +1,47 @@ +<!-- +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +--> + +# Configuration file switching based on environment variables + +The reason the configuration is extracted from the code is to better adapt to changes. Usually our applications have different +operating environments such as development environment and production environment. Certain configurations of these applications +will definitely be different, such as the address of the configuration center. + +If the configuration of all environments is placed in the same file, it is very difficult to manage. After receiving new +requirements, we need to change the parameters in the configuration file to the development environment when developing the +development environment. You have to change it back. It's very easy to make mistakes. + +The solution to the above problem is to distinguish the current running environment through environment variables, and switch +between different configuration files through environment variables. The corresponding environment variable in APISIX is: `APISIX_PROFILE` + + +When `APISIX_PROFILE` is not set, the following three configuration files are used by default: + +* conf/config.yaml +* conf/apisix.yaml +* conf/debug.yaml + +If the value of `APISIX_PROFILE` is set to` prod`, the following three configuration files are used: + +* conf/config-prod.yaml +* conf/apisix-prod.yaml +* conf/debug-prod.yaml + +Although this way will increase the number of configuration files, it can be managed independently, and then version management +tools such as git can be configured, and version management can be better achieved.