Other question… Like I’ve said before… Y have `Sta...
# sst
a
Other question… Like I’ve said before… Y have
StaticSite
 for one site, and 
ReactSite
for other site… now.. both sites must be connected from a link, so what I do is expose an env-var on each of them, to receive the “deployment URL” of where those got deployed. Now the problem is… BOTH sites has to be connected.. and each of them belongs to different stacks… how should I share information between inter-dependent stacks? Today I have…
Website2Stack
-> depends on
Website1Stack
… that way the first stack can access the URL defined in the second. But now I need to do the opposite too.
t
Tricky situation
a
Yeah.
Im moving the domain name outside of stack.
So I have 2 websites:
<http://mycompany.com|mycompany.com>
<http://account.mycompany.com|account.mycompany.com>
Each of them have their own stack + custom-domain.
t
With the way our staticsite works this is impossible afaik. I would maybe create a mapping of the custom domains you use in each environment and reference them based off stage name
Copy code
const Website1Domains = {
  production: "...",
  staging: "...",
}
a
Yeah.
I do that… but in each stack.
I mean, I wanted to have “account stack” to have all stuff related to Account.
But if I move the domain outside, is not encapsulated anymore.
But no big deal.
t
Right. Another option is to use a common pattern for every stage so one website can infer the name of the other one just from the stage name
Basically the same though
a
Yeah.
I didn’t want to infer.
Just reference.
f
@Adrián Mouly what do you want to share between the 2 sites, endpoint?
a
@Frank the “website url”.
Both sites has links to each other.
I want to share this value ->
customDomainUrl()
.
f
I see.. and the both sites are in the same stack right?
a
No, are 2 different stacks.
f
I see.. that’s not possible i think. One stack has to be created before another, so mutual dependency won’t work.
You can try using SSM.
In each stack, you create an SSM key with the url. And pass
ssm.StringParameter.valueForStringParameter()
to StaticSite environment.
a
Interesting idea.
Still, the variable might not be defined.
t
I think
ssm.StringParameter.valueForStringParameter()
actually resolves at build time
because it gets loaded into your context
a
Ok that could be a solution.