Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crear la configuracion unica mediante un archivo #220

Open
Murzbul opened this issue Mar 1, 2024 · 0 comments
Open

Crear la configuracion unica mediante un archivo #220

Murzbul opened this issue Mar 1, 2024 · 0 comments
Assignees

Comments

@Murzbul
Copy link
Contributor

Murzbul commented Mar 1, 2024

export function config2 =
{
APP: {
DEFAULT: {
type: 'string',
default: 'FastifyBootstrapping'
env: false
},
PATH: {
type: 'string',
env: true,
var: 'APP_PATH'
},
PORT: { // Por defecto se entiende que es APP_PORT ya que no existe el campo var
type: 'port',
default: 8090
}
},
MESSAGE_BROKER_URI: {
type: 'uri',
default: 8090
}
}
Modo de uso

MainConfig.getValues().app.default === APP_DEFAULT

MainConfig.getValues().messageBrokerUri === MESSAGE_BROKER_URI

Caracteristicas

type: Los tipos posibles. Por ahora podrian ser todos los que vienen de envalid.

string
boolean
uri
email
port
number

default: Valor por defecto. Que sucede si no tenemos valor por defecto? Es valido solo en casos en donde no sean variables de entorno.
env: true o false, si viene de una variable de entorno. Si no existe la key se toma como false.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🔖 Ready
Development

No branches or pull requests

2 participants