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

Why does app.tsx directly import infrastructure config? #360

Closed
dfkunstler opened this issue Feb 5, 2024 · 1 comment
Closed

Why does app.tsx directly import infrastructure config? #360

dfkunstler opened this issue Feb 5, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@dfkunstler
Copy link
Contributor

import * as InfraConfig from '../../../../bin/config.json';

I believe the reference above was introduced in 4.0.2.

My question is, why create an explicit dependency on config.json, which isn't part of the source tree, when a default config available? Obviously we expect people to generate a config, but prior to this release it was possible to do a clean build from source using the default config produced by config.ts:

return JSON.parse(readFileSync("./bin/config.json").toString("utf8"));

IMO that default config mechanism is important. It gives us a way to test that a new release works as shipped before introducing local config (typically generated by a previous release). Then if build fails for any reason, we can easily determine if previous local config is the source of the trouble.

I assume that it was implemented this way to avoid a dependency between runtime app code and infrastructure code, and i certainly support that choice. If that's the case, then i'd argue it should extend also to configuration files. Application runtime config should separate from infrastructure config (as in the aws-exports.json file).

Apologies in advance if i've misunderstood something. Thanks for taking the time to explain.

@bigadsoleiman
Copy link
Collaborator

Hi @dfkunstler thanks for pointing this out
importing a file from the CDK domain into the react-app domain was simply wrong.

This has been addressed with #367

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

2 participants