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

Improve config constants pickup #195

Open
nfroidure opened this issue Dec 5, 2024 · 0 comments
Open

Improve config constants pickup #195

nfroidure opened this issue Dec 5, 2024 · 0 comments
Assignees

Comments

@nfroidure
Copy link
Owner

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.

@nfroidure nfroidure self-assigned this Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant