use a resource that uses api.url allow origin in api's allow.origin
#6307
tsuf239
announced in
Announcements
Replies: 4 comments
0 replies
|
It looks like there's a dependency cycle between the resources in the code (each is trying to depend on the other). Is it possible to make one of them add configuration later? e.g. bring cloud;
class ImaginaryResource {
pub url: str;
env: MutMap<str>;
new () {
// initializing some terraform and stuff....
// doing some stuff with the env.
this.url = "some terraform token";
this.env = MutMap<str>{};
}
pub addEnv(key: str, value: str) {
this.env.set(key, value);
}
}
// the imaginary resource needs the api.url in its environment- since it's
// essential to the initiation.
let imaginary = new ImaginaryResource();
// creating a url that supports only the imaginary origin
let api = new cloud.Api(corsOptions:{allowOrigin: imaginary.url});
imaginary.addEnv("API_URL", api.url);(some way to add CORS options to |
0 replies
|
also, this may work: |
0 replies
|
Recapping some of the options the team came up with offline:
let domain = new cloud.Domain(url: "example.com");
let api = new cloud.Api(corsOptions:{allowOrigin: domain.url});
let server = new WebsiteServer({ API_URL: domain.url });
let var serverUrl: str? = nil;
let api = new cloud.Api(corsOptions:{
allowOrigin: cdktf.Lazy.string({ produce: () => { return serverUrl!; } }),
});
let server = new WebsiteServer({API_URL: api.url});
serverUrl = server.url;It's possible we'll need to add support for something like this to the |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I tried this:
This happened:
I couldn't use a property
urlof a resource that wasn't initialized yet :(I expected this:
to have a way to pass that
Is there a workaround?
No response
Anything else?
No response
Wing Version
0.66.5
Node.js Version
No response
Platform(s)
No response
Community Notes
All reactions