I’m experimenting with a monorepo with 2 websites.
mono repo
|__website1
|__website2
I have a TOML file in website1 and website2 folders but when I create a new site in Netlify:
a) it doesn’t automatically create 2 sites using the config files?
b) if I create sites manually in Netlify UI, it doesn’t load the environment variable?
Re a) I would’ve thought config as code should speed up the process and reduce the manual effort of creating multiple sites using the UI, no?
Re b) if (a) isn’t true, then if I do create it in the UI, why is the env variable not getting picked up?
Configuring your code may help speed up the process and reduce manual effort. However, you would need to set up separate sites manually or use the API to automate the process of creating multiple sites based on the monorepo sructure.
You can also consider using a CI/CD pipelines using continuous deployment
I hope this answers you queries, i’m not too familiar with monorepos hopefully someone else can fill the gaps. (;
Thanks, @SamO. So the configuration as code isn’t meant to create the sites themselves? Also, why did the configuration like env variables not get applied from the configuration as code?
Oh yeah, CICD sounds good, if it can also create the site automatically if one isn’t already created. I’ll take a look at that soon.
Wouldn’t this require us to scan your entire repo to find two files? Someone else might put it in deep nested folders, so overall this seems like an overkill and not something that needs to be implemented.
Basically, no. Not sure why you got the idea. Maybe we can improve some docs or guides that would have made you think so?
Where and how are you using that variable? I don’t see anything specific about that for your site.
I was following this guide. I read the build directory and commands as required settings for the site rather than custom optional settings for the site.
In the guide linked above, I’m assuming SITE1_SPECIFIC_FLAG will show up in the environment variables section and this should be created automatically (assuming the site is already created). Is this right?