Skip to content

Improve config constants pickup #195

@nfroidure

Description

@nfroidure

When picking constants values in the config, now that the location property can be associated to Knifecycle initializers, we could instead of stringifying constants, directly import it from the config file:

if (APP_CONFIG && APP_CONFIG[injectedName]) {
log(
'debug',
`📖 - Picking the "${injectedName}" constant in the "APP_CONFIG" service properties.`,
);
return constant(injectedName, APP_CONFIG[injectedName]);
}

That said, it would necessit to not use the default export but instead use named exports to be able to load the configurations via Knifecycle builds, leading to the same problem that the following issue needs : whole module typing.

A side effect of it would be that the configuration constants, currently stringified by the build, would now be dynamically assigned (so any logic inside it would also operate in the build, ie reading env to selectively enable a config). Not sure it is a good or bad thing. Need some thinking before deciding.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions