Skip to content

Commit

Permalink
(es) config-overrides-with-env-var.md (#1026)
Browse files Browse the repository at this point in the history
Co-authored-by: ShadowNet <tony931023@gmail.com>
  • Loading branch information
Snet-Cuba and Tony931023 authored Nov 14, 2024
1 parent eecfa24 commit cb6c6e3
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
7 changes: 4 additions & 3 deletions docs/config-overrides-with-env-var.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Environment variables can override config values.

By default the core will listen to conf values in this order:

```
1. Environment variables
2. .conf file
Expand All @@ -19,15 +20,15 @@ Environment variables keys are autogenerated based on the keys defined in .conf
// GM.InGMList.Level => AC_GM_IN_GMLIST_LEVEL
```

Usage example
## Usage example

Unix:
**Unix:**
```sh
$ export AC_DATA_DIR=/usr
$ AC_WORLD_SERVER_PORT=8080 ./worldserver
```

Windows:
**Windows:**
```ps
> $env:AC_REALM_ID = '2'; .\worldserver
```
34 changes: 34 additions & 0 deletions docs/es/config-overrides-with-env-var.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Sobrescritura de Configuración con Variables de Entorno

Las variables de entorno pueden sobrescribir los valores de configuración.

Por defecto, el núcleo escuchará los valores de configuración en este orden:

```
1. Variables de entorno
2. Archivo .conf
3. Valores base definidos en el núcleo
```

Las claves de las variables de entorno se generan automáticamente en base a las claves definidas en el archivo .conf.

```cpp
// Ejemplo de conversiones:
// SomeConfig => SOME_CONFIG
// myNestedConfig.opt1 => MY_NESTED_CONFIG_OPT_1
// LogDB.Opt.ClearTime => LOG_DB_OPT_CLEAR_TIME
// GM.InGMList.Level => AC_GM_IN_GMLIST_LEVEL
```

## Ejemplo de uso

**Unix:**
```sh
$ export AC_DATA_DIR=/usr
$ AC_WORLD_SERVER_PORT=8080 ./worldserver
```

**Windows:**
```ps
> $env:AC_REALM_ID = '2'; .\worldserver
```

0 comments on commit cb6c6e3

Please sign in to comment.