nfrankel commented on code in PR #10021:
URL: https://github.com/apache/apisix/pull/10021#discussion_r1293550954


##########
docs/en/latest/profile.md:
##########
@@ -21,28 +27,66 @@ title: 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.
+Extracting configuration from the code makes APISIX adaptable to changes in 
the operating environments. For example, APISIX can be deployed in a 
development environment for testing and then moved to a production environment. 
The configuration for APISIX in these environments would be different.
 
-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.
+APISIX supports managing multiple configurations through environment variables 
in two different ways:
 
-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`
+1. Using environment variables in the configuration file
+2. Using an environment variable to switch between multiple configuration 
profiles
 
-When `APISIX_PROFILE` is not set, the following three configuration files are 
used by default:
+## Using environment variables in the configuration file
 
-* conf/config.yaml
-* conf/apisix.yaml
-* conf/debug.yaml
+This is useful when you want to change some configurations based on the 
environment.
+
+The example below shows how you can modify your configuration file to use 
environment variables to set the listening ports of APISIX:

Review Comment:
   Please explain the syntax, and only then offer an example.



##########
docs/en/latest/profile.md:
##########
@@ -21,28 +27,66 @@ title: 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.
+Extracting configuration from the code makes APISIX adaptable to changes in 
the operating environments. For example, APISIX can be deployed in a 
development environment for testing and then moved to a production environment. 
The configuration for APISIX in these environments would be different.
 
-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.
+APISIX supports managing multiple configurations through environment variables 
in two different ways:
 
-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`
+1. Using environment variables in the configuration file
+2. Using an environment variable to switch between multiple configuration 
profiles
 
-When `APISIX_PROFILE` is not set, the following three configuration files are 
used by default:
+## Using environment variables in the configuration file
 
-* conf/config.yaml
-* conf/apisix.yaml
-* conf/debug.yaml
+This is useful when you want to change some configurations based on the 
environment.
+
+The example below shows how you can modify your configuration file to use 
environment variables to set the listening ports of APISIX:
+
+```yaml title="config.yaml"
+apisix:
+  node_listen:
+    - ${{APISIX_NODE_LISTEN:=9080}}                 
+deployment:
+  admin:
+    admin_listen:
+      port: ${{DEPLOYMENT_ADMIN_ADMIN_LISTEN:=9180}} 
+```
+
+Now when you run APISIX, you can set these environment variables dynamically:
+
+```shell
+export APISIX_NODE_LISTEN=8132
+export DEPLOYMENT_ADMIN_ADMIN_LISTEN=9232
+```
+
+If you don't set these environment variables, the configuration will use the 
default values provided.

Review Comment:
   We should tell about default values but also without. Otherwise, questions 
will come up regarding - what if you don't provide default values 



##########
docs/en/latest/profile.md:
##########
@@ -21,28 +27,66 @@ title: 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.
+Extracting configuration from the code makes APISIX adaptable to changes in 
the operating environments. For example, APISIX can be deployed in a 
development environment for testing and then moved to a production environment. 
The configuration for APISIX in these environments would be different.
 
-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.
+APISIX supports managing multiple configurations through environment variables 
in two different ways:
 
-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`
+1. Using environment variables in the configuration file
+2. Using an environment variable to switch between multiple configuration 
profiles
 
-When `APISIX_PROFILE` is not set, the following three configuration files are 
used by default:
+## Using environment variables in the configuration file
 
-* conf/config.yaml
-* conf/apisix.yaml
-* conf/debug.yaml
+This is useful when you want to change some configurations based on the 
environment.
+
+The example below shows how you can modify your configuration file to use 
environment variables to set the listening ports of APISIX:
+
+```yaml title="config.yaml"
+apisix:
+  node_listen:
+    - ${{APISIX_NODE_LISTEN:=9080}}                 
+deployment:
+  admin:
+    admin_listen:
+      port: ${{DEPLOYMENT_ADMIN_ADMIN_LISTEN:=9180}} 
+```
+
+Now when you run APISIX, you can set these environment variables dynamically:
+
+```shell
+export APISIX_NODE_LISTEN=8132
+export DEPLOYMENT_ADMIN_ADMIN_LISTEN=9232
+```
+
+If you don't set these environment variables, the configuration will use the 
default values provided.
+
+## Using the `APISIX_PROFILE` environment variable
+
+If you have multiple configuration changes for multiple environments, it might 
be better to have a different configuration file for each.
 
-If the value of `APISIX_PROFILE` is set to `prod`, the following three 
configuration files are used:
+Although this might increase the number of configuration files, you would be 
able to manage each independently and can even do version management.
+
+To achieve this, you can have multiple sets of configuration files. For 
example for the production environment, you can have:

Review Comment:
   As above, please mention the rule about `APISIX_PROFILE` and then the 
example.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to