Skip to content

Commit 2e0c6b7

Browse files
committed
Update Environment variable documentation
1 parent e75df9e commit 2e0c6b7

File tree

5 files changed

+110
-52
lines changed

5 files changed

+110
-52
lines changed

docs/docs/docs/getting-started/environment-variables.md

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,48 @@ This environment variable is used to configure the host ip of the postgres serve
223223

224224
- More information can be found at [this](https://github.com/porsager/postgres?tab=readme-ov-file##environmental-variables) link.
225225

226+
### API_REDIS_HOST
227+
228+
This environment variable is used to configure the host ip of the redis server for talawa api's redis client to connect with.
229+
230+
- More information can be found at [this](https://github.com/redis/redis) link.
231+
232+
### API_REDIS_PORT
233+
234+
This environment variable is used to configure the host port of the redis server for talawa api's redis client to connect with.
235+
236+
- More information can be found at [this](https://github.com/redis/redis) link.
237+
238+
### API_REDIS_TEST_HOST
239+
240+
This environment variable is used to configure the host ip of the redis server for talawa api's redis client to connect with.
241+
242+
- More information can be found at [this](https://github.com/redis/redis) link.
243+
244+
### API_GRAPHQL_SCALAR_FIELD_COST
245+
246+
This environment variable defines the cost assigned to scalar fields in GraphQL queries. Scalars are basic data types like String, Int, Boolean, etc.
247+
248+
### API_GRAPHQL_OBJECT_FIELD_COST
249+
250+
This environment variable sets the cost of resolving object fields in a GraphQL query. Object fields return nested data structures instead of primitive values.
251+
252+
### API_GRAPHQL_LIST_FIELD_COST
253+
254+
This environment variable specifies the cost of retrieving list fields in GraphQL queries. Lists contain multiple items, making them more resource-intensive than scalar fields.
255+
256+
### API_GRAPHQL_MUTATION_BASE_COST
257+
258+
This environment variable defines the base cost of executing a GraphQL mutation. Mutations typically modify data, making them more expensive than queries.
259+
260+
### API_RATE_LIMIT_BUCKET_CAPACITY
261+
262+
This environment variable defines the maximum capacity of the leaky bucket used for rate limiting based on GraphQL query cost analysis. The bucket holds tokens that represent available request capacity.
263+
264+
### API_RATE_LIMIT_REFILL_RATE
265+
266+
This environment variable specifies the number of tokens added to the leaky bucket per second. This determines how quickly users can regain the ability to make GraphQL requests after hitting the rate limit.
267+
226268
### CI
227269

228270
This environment variable is used to enable or disable certain features in vitest that are supposed to only run in continous integration environments.
@@ -467,12 +509,49 @@ Listed below is a subset of environment variables that are accepted by the `post
467509

468510
More information could be found at [this](https://github.com/docker-library/docs/blob/master/postgres/README.md##environment-variables) link.
469511

512+
### POSTGRES_MAPPED_HOST_IP
513+
514+
This environment variable is used to configure the host ip that can access the host port mapped with the container service port on which postgres listens to at runtime.
515+
516+
- More information can be found at [this](https://docs.docker.com/engine/network/##published-ports) link.
517+
470518
### POSTGRES_TEST_MAPPED_PORT
471519

472520
This environment variable is used to configure the host port to map with the container service port on which postgres test listens to at runtime.
473521

474522
- More information can be found at [this](https://docs.docker.com/engine/network/##published-ports) link.
475523

524+
## redis (Container)
525+
526+
Listed below is a subset of environment variables that are accepted by the `redis` container service.
527+
528+
More information could be found at [this](https://github.com/redis/redis) link.
529+
530+
### REDIS_MAPPED_HOST_IP
531+
532+
This environment variable is used to configure the host ip that can access the host port mapped with the container service port on which redis listens to at runtime.
533+
534+
- More information can be found at [this](https://docs.docker.com/engine/network/##published-ports) link.
535+
536+
### REDIS_MAPPED_PORT
537+
538+
This environment variable is used to configure the host port to map with the container service port on which redis listens to at runtime.
539+
540+
- More information can be found at [this](https://docs.docker.com/engine/network/##published-ports) link.
541+
542+
## redis-test (Container)
543+
544+
Listed below is a subset of environment variables that are accepted by the `redis-test` container service.
545+
546+
More information could be found at [this](https://github.com/redis/redis) link.
547+
548+
### REDIS_TEST_MAPPED_PORT
549+
550+
This environment variable is used to configure the host port to map with the container service port on which redis test listens to at runtime.
551+
552+
- More information can be found at [this](https://docs.docker.com/engine/network/##published-ports) link.
553+
554+
476555
## docker compose
477556

478557
### COMPOSE_FILE
@@ -483,7 +562,7 @@ This environment variable is used to configure what docker compose configuration
483562

484563
### COMPOSE_PROFILES
485564

486-
This environment variable is used to enable or disable container services to be run by docker compose. Possible values are `api`, `caddy`, `cloudbeaver`, `minio`, `minio_test`, `postgres` and `postgres-test`.
565+
This environment variable is used to enable or disable container services to be run by docker compose. Possible values are `api`, `caddy`, `cloudbeaver`, `minio`, `minio_test`, `postgres`, `postgres_test`, `redis` and `redis_test`.
487566

488567
- More information can be found at [this](https://docs.docker.com/compose/environment-variables/envvars/##compose_profiles) link.
489568

envFiles/.env.ci

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,16 @@ API_POSTGRES_PASSWORD=password
3535
API_POSTGRES_PORT=5432
3636
API_POSTGRES_SSL_MODE=false
3737
API_POSTGRES_TEST_HOST=postgres-test
38-
API_REDIS_TEST_HOST=redis-test
3938
API_POSTGRES_USER=talawa
4039
API_REDIS_HOST=redis
4140
API_REDIS_PORT=6379
41+
API_REDIS_TEST_HOST=redis-test
42+
API_GRAPHQL_SCALAR_FIELD_COST=0
43+
API_GRAPHQL_OBJECT_FIELD_COST=1
44+
API_GRAPHQL_LIST_FIELD_COST=1
45+
API_GRAPHQL_MUTATION_BASE_COST=10
46+
API_RATE_LIMIT_BUCKET_CAPACITY=500
47+
API_RATE_LIMIT_REFILL_RATE=100
4248
# https://vitest.dev/config/#watch
4349
CI=true
4450
# https://blog.platformatic.dev/handling-environment-variables-in-nodejs#heading-set-nodeenvproduction-for-all-environments
@@ -77,18 +83,7 @@ COMPOSE_FILE=./compose.yaml:./docker/compose.testing.yaml
7783
COMPOSE_PROFILES=api,minio_test,postgres_test,redis_test,redis
7884
COMPOSE_PROJECT_NAME=talawa
7985

80-
############## base cost for graphql fields ##############
81-
82-
API_GRAPHQL_SCALAR_FIELD_COST=0
83-
API_GRAPHQL_OBJECT_FIELD_COST=1
84-
API_GRAPHQL_LIST_FIELD_COST=1
85-
API_GRAPHQL_MUTATION_BASE_COST=10
86-
87-
############## rate limiting ##############
88-
89-
API_RATE_LIMIT_BUCKET_CAPACITY=10000
90-
API_RATE_LIMIT_REFILL_RATE=100
91-
9286
############## docker compose `redis` container service ##############
87+
9388
REDIS_MAPPED_HOST_IP=127.0.0.1
9489
REDIS_MAPPED_PORT=6379

envFiles/.env.deploy

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ API_POSTGRES_SSL_MODE=false
4646
API_POSTGRES_USER=talawa
4747
API_REDIS_HOST=redis
4848
API_REDIS_PORT=6379
49+
API_GRAPHQL_SCALAR_FIELD_COST=0
50+
API_GRAPHQL_OBJECT_FIELD_COST=1
51+
API_GRAPHQL_LIST_FIELD_COST=1
52+
API_GRAPHQL_MUTATION_BASE_COST=10
53+
API_RATE_LIMIT_BUCKET_CAPACITY=500
54+
API_RATE_LIMIT_REFILL_RATE=100
4955
# https://vitest.dev/config/#watch
5056
CI=false
5157
# https://blog.platformatic.dev/handling-environment-variables-in-nodejs#heading-set-nodeenvproduction-for-all-environments
@@ -86,18 +92,7 @@ COMPOSE_FILE=./compose.yaml
8692
COMPOSE_PROFILES=api,caddy,minio,postgres,redis
8793
COMPOSE_PROJECT_NAME=talawa
8894

89-
############## base cost for graphql fields ##############
90-
91-
API_GRAPHQL_SCALAR_FIELD_COST=0
92-
API_GRAPHQL_OBJECT_FIELD_COST=1
93-
API_GRAPHQL_LIST_FIELD_COST=1
94-
API_GRAPHQL_MUTATION_BASE_COST=10
95-
96-
############## rate limiting ##############
97-
98-
API_RATE_LIMIT_BUCKET_CAPACITY=100
99-
API_RATE_LIMIT_REFILL_RATE=10
100-
10195
############## docker compose `redis` container service ##############
96+
10297
REDIS_MAPPED_HOST_IP=127.0.0.1
10398
REDIS_MAPPED_PORT=6379

envFiles/.env.devcontainer

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,16 @@ API_POSTGRES_PASSWORD=password
3737
API_POSTGRES_PORT=5432
3838
API_POSTGRES_SSL_MODE=false
3939
API_POSTGRES_TEST_HOST=postgres-test
40-
API_REDIS_TEST_HOST=redis-test
4140
API_POSTGRES_USER=talawa
4241
API_REDIS_HOST=redis
4342
API_REDIS_PORT=6379
43+
API_REDIS_TEST_HOST=redis-test
44+
API_GRAPHQL_SCALAR_FIELD_COST=0
45+
API_GRAPHQL_OBJECT_FIELD_COST=1
46+
API_GRAPHQL_LIST_FIELD_COST=1
47+
API_GRAPHQL_MUTATION_BASE_COST=10
48+
API_RATE_LIMIT_BUCKET_CAPACITY=500
49+
API_RATE_LIMIT_REFILL_RATE=100
4450
# https://vitest.dev/config/#watch
4551
CI=false
4652
# https://blog.platformatic.dev/handling-environment-variables-in-nodejs#heading-set-nodeenvproduction-for-all-environments
@@ -107,23 +113,11 @@ COMPOSE_FILE=./compose.yaml:./docker/compose.testing.yaml:./docker/compose.devco
107113
COMPOSE_PROFILES=api,caddy,cloudbeaver,minio,minio_test,postgres,postgres_test,redis_test,redis
108114
COMPOSE_PROJECT_NAME=talawa
109115

110-
############## base cost for graphql fields ##############
111-
112-
API_GRAPHQL_SCALAR_FIELD_COST=0
113-
API_GRAPHQL_OBJECT_FIELD_COST=1
114-
API_GRAPHQL_LIST_FIELD_COST=1
115-
API_GRAPHQL_MUTATION_BASE_COST=10
116-
117-
############## rate limiting ##############
118-
119-
API_RATE_LIMIT_BUCKET_CAPACITY=100
120-
API_RATE_LIMIT_REFILL_RATE=10
121-
122116
############## docker compose `redis` container service ##############
117+
123118
REDIS_MAPPED_HOST_IP=127.0.0.1
124119
REDIS_MAPPED_PORT=6379
125120

126-
127121
########## docker compose `redis-test` container service ##########
128122

129123
REDIS_TEST_MAPPED_PORT=6378

envFiles/.env.production

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ API_POSTGRES_SSL_MODE=false
3636
API_POSTGRES_USER=talawa
3737
API_REDIS_HOST=redis
3838
API_REDIS_PORT=6379
39+
API_GRAPHQL_SCALAR_FIELD_COST=0
40+
API_GRAPHQL_OBJECT_FIELD_COST=1
41+
API_GRAPHQL_LIST_FIELD_COST=1
42+
API_GRAPHQL_MUTATION_BASE_COST=10
43+
API_RATE_LIMIT_BUCKET_CAPACITY=500
44+
API_RATE_LIMIT_REFILL_RATE=100
3945
# https://vitest.dev/config/#watch
4046
CI=false
4147
# https://blog.platformatic.dev/handling-environment-variables-in-nodejs#heading-set-nodeenvproduction-for-all-environments
@@ -74,18 +80,7 @@ COMPOSE_FILE=./compose.yaml
7480
COMPOSE_PROFILES=api,caddy,minio,postgres,redis
7581
COMPOSE_PROJECT_NAME=talawa
7682

77-
############## base cost for graphql fields ##############
78-
79-
API_GRAPHQL_SCALAR_FIELD_COST=0
80-
API_GRAPHQL_OBJECT_FIELD_COST=1
81-
API_GRAPHQL_LIST_FIELD_COST=1
82-
API_GRAPHQL_MUTATION_BASE_COST=10
83-
84-
############## rate limiting ##############
85-
86-
API_RATE_LIMIT_BUCKET_CAPACITY=100
87-
API_RATE_LIMIT_REFILL_RATE=10
88-
8983
############## docker compose `redis` container service ##############
84+
9085
REDIS_MAPPED_HOST_IP=127.0.0.1
9186
REDIS_MAPPED_PORT=6379

0 commit comments

Comments
 (0)