You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "navendu-pottekkat (via GitHub)" <gi...@apache.org> on 2023/08/14 14:30:36 UTC

[GitHub] [apisix] navendu-pottekkat opened a new pull request, #10021: docs: mention how to use environment variables in configuration file

navendu-pottekkat opened a new pull request, #10021:
URL: https://github.com/apache/apisix/pull/10021

   Signed-off-by: Navendu Pottekkat <na...@apache.org>
   
   Adds instructions on how to use environment variables with configuration files in addition to using an environment variable to switch between multiple configuration files.
   
   So now we are suggesting two ways to manage configuration while deploying APISIX in multiple environments.


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] nfrankel commented on a diff in pull request #10021: docs: mention how to use environment variables in configuration file

Posted by "nfrankel (via GitHub)" <gi...@apache.org>.
nfrankel commented on code in PR #10021:
URL: https://github.com/apache/apisix/pull/10021#discussion_r1299391623


##########
docs/en/latest/profile.md:
##########
@@ -57,15 +57,27 @@ 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.
+To use default values if no environment variables are set, you can add it to your configuration file as shown below:
+
+```yaml title="config.yaml"
+apisix:
+  node_listen:
+    - ${{APISIX_NODE_LISTEN:=9080}}                 
+deployment:
+  admin:
+    admin_listen:
+      port: ${{DEPLOYMENT_ADMIN_ADMIN_LISTEN:=9180}} 
+```
 

Review Comment:
   Hey @navendu-pottekkat, perhaps you did miss this request?



-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] nfrankel commented on a diff in pull request #10021: docs: mention how to use environment variables in configuration file

Posted by "nfrankel (via GitHub)" <gi...@apache.org>.
nfrankel commented on code in PR #10021:
URL: https://github.com/apache/apisix/pull/10021#discussion_r1293688402


##########
docs/en/latest/profile.md:
##########
@@ -57,15 +57,27 @@ export APISIX_NODE_LISTEN=8132
 export DEPLOYMENT_ADMIN_ADMIN_LISTEN=9232
 ```
 

Review Comment:
   I know it sounds stupid, but please sum up like: at this point, Apisix listens on port 8132 and ...



##########
docs/en/latest/profile.md:
##########
@@ -57,15 +57,27 @@ 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.
+To use default values if no environment variables are set, you can add it to your configuration file as shown below:
+
+```yaml title="config.yaml"
+apisix:
+  node_listen:
+    - ${{APISIX_NODE_LISTEN:=9080}}                 
+deployment:
+  admin:
+    admin_listen:
+      port: ${{DEPLOYMENT_ADMIN_ADMIN_LISTEN:=9180}} 
+```
 

Review Comment:
   Likewise, please sum up



-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] monkeyDluffy6017 merged pull request #10021: docs: mention how to use environment variables in configuration file

Posted by "monkeyDluffy6017 (via GitHub)" <gi...@apache.org>.
monkeyDluffy6017 merged PR #10021:
URL: https://github.com/apache/apisix/pull/10021


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] monkeyDluffy6017 commented on pull request #10021: docs: mention how to use environment variables in configuration file

Posted by "monkeyDluffy6017 (via GitHub)" <gi...@apache.org>.
monkeyDluffy6017 commented on PR #10021:
URL: https://github.com/apache/apisix/pull/10021#issuecomment-1680948158

   Please make  the ci pass


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] nfrankel commented on a diff in pull request #10021: docs: mention how to use environment variables in configuration file

Posted by "nfrankel (via GitHub)" <gi...@apache.org>.
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] monkeyDluffy6017 commented on a diff in pull request #10021: docs: mention how to use environment variables in configuration file

Posted by "monkeyDluffy6017 (via GitHub)" <gi...@apache.org>.
monkeyDluffy6017 commented on code in PR #10021:
URL: https://github.com/apache/apisix/pull/10021#discussion_r1300430320


##########
docs/en/latest/profile.md:
##########
@@ -57,15 +57,27 @@ 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.
+To use default values if no environment variables are set, you can add it to your configuration file as shown below:
+
+```yaml title="config.yaml"
+apisix:
+  node_listen:
+    - ${{APISIX_NODE_LISTEN:=9080}}                 
+deployment:
+  admin:
+    admin_listen:
+      port: ${{DEPLOYMENT_ADMIN_ADMIN_LISTEN:=9180}} 
+```
 

Review Comment:
   @navendu-pottekkat please check this



-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [apisix] navendu-pottekkat commented on a diff in pull request #10021: docs: mention how to use environment variables in configuration file

Posted by "navendu-pottekkat (via GitHub)" <gi...@apache.org>.
navendu-pottekkat commented on code in PR #10021:
URL: https://github.com/apache/apisix/pull/10021#discussion_r1301342724


##########
docs/en/latest/profile.md:
##########
@@ -57,15 +57,27 @@ 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.
+To use default values if no environment variables are set, you can add it to your configuration file as shown below:
+
+```yaml title="config.yaml"
+apisix:
+  node_listen:
+    - ${{APISIX_NODE_LISTEN:=9080}}                 
+deployment:
+  admin:
+    admin_listen:
+      port: ${{DEPLOYMENT_ADMIN_ADMIN_LISTEN:=9180}} 
+```
 

Review Comment:
   @nfrankel @monkeyDluffy6017 Done



-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org