Update documentation to customize the application config

This commit is contained in:
Javi Martín
2024-08-30 15:24:20 +02:00
parent 0b928e52b1
commit a4063d0ec0
8 changed files with 54 additions and 32 deletions

View File

@@ -37,7 +37,7 @@
* [Controllers](customization/controllers.md)
* [Components](customization/components.md)
* [Gems](customization/gems.md)
* [Overwriting Application](customization/overwriting.md)
* [Application configuration](customization/application.md)
* [Technical Features](features/features.md)
* [OAuth](features/oauth.md)

View File

@@ -0,0 +1,25 @@
# Customizing application configuration
## Overwriting application.rb
If you need to extend or modify the `config/application.rb` file, you can do so using the `config/application_custom.rb` file. For example, if you'd like to change the application timezone to the Canary Islands, just add:
```ruby
module Consul
class Application < Rails::Application
config.time_zone = "Atlantic/Canary"
end
end
```
In this particular case, note that the application time zone can alternatively be modified by editing the `config/secrets.yml` file.
Remember that in order to apply these changes you'll need to restart the application.
## Overwriting environment configuration
If you'd like to customize the development, test, staging, preproduction or production environments, you can do so by editing the files under `config/environments/custom/`.
Note that changes in `config/environments/custom/production.rb` are also applied to the staging and preproduction environments, and changes in `config/environments/custom/staging.rb` are also applied to the preproduction environment.
And remember that in order to apply these changes you'll need to restart the application.

View File

@@ -9,4 +9,4 @@
* [Controllers](controllers.md)
* [Components](components.md)
* [Gems](gems.md)
* [Overwriting Application](overwriting.md)
* [Application configuration](application.md)

View File

@@ -1,14 +0,0 @@
# Overwriting application.rb
If you need to extend or modify the `config/application.rb` just do it at the `config/application_custom.rb` file. For example if you want to change de default language to English, just add:
```ruby
module Consul
class Application < Rails::Application
config.i18n.default_locale = :en
config.i18n.available_locales = [:en, :es]
end
end
```
Remember that in order to see this changes live you'll need to restart the server.

View File

@@ -37,7 +37,7 @@
* [Controladores](customization/controllers.md)
* [Componentes](customization/components.md)
* [Gemas](customization/gems.md)
* [Adaptar la aplicación](customization/overwriting.md)
* [Configuración de la aplicación](customization/application.md)
* [Funcionalidades Técnicas](features/features.md)
* [OAuth](features/oauth.md)

View File

@@ -0,0 +1,25 @@
# Personalización de la configuración de la aplicación
## Personalizar application.rb
Cuando necesites extender o modificar el `config/application.rb`, puedes hacerlo a través del fichero `config/application_custom.rb`. Por ejemplo, si quieres modificar la zona horaria de la aplicación para que utilice la de las Islas Canarias, añade:
```ruby
module Consul
class Application < Rails::Application
config.time_zone = "Atlantic/Canary"
end
end
```
En este caso concreto, la zona horaria de la aplicación también puede modificarse editando el fichero `config/secrets.yml`.
Recuerda que para ver reflejados estos cambios debes reiniciar la aplicación.
## Personalizar la configuración de los entornos
Para personalizar los entornos de desarrollo, test, "staging", preproducción o producción, puedes editar los ficheros en `config/environments/custom/`.
Ten en cuenta que los cambios en `config/environments/custom/production.rb` se aplicarán también a los entornos de "staging" y de preproducción, y que los cambios en `config/environments/custom/staging.rb` se aplicarán también al entorno de preproducción.
Y recuerda que para ver reflejados estos cambios debes reiniciar la aplicación.

View File

@@ -9,4 +9,4 @@
* [Controladores](controllers.md)
* [Componentes](components.md)
* [Gemas](gems.md)
* [Adaptar la aplicación](overwriting.md)
* [Configuración de la aplicación](application.md)

View File

@@ -1,14 +0,0 @@
# Adaptar application.rb
Cuando necesites extender o modificar el `config/application.rb` puedes hacerlo a través del fichero `config/application_custom.rb`. Por ejemplo si quieres modificar el idioma por defecto al inglés pondrías lo siguiente:
```ruby
module Consul
class Application < Rails::Application
config.i18n.default_locale = :en
config.i18n.available_locales = [:en, :es]
end
end
```
Recuerda que para ver reflejado estos cambios debes reiniciar el servidor de desarrollo.