s3_website
s3_website copied to clipboard
staging and production environment variables
Hi,
How do I pass to s3_website on the command line whether it's staging or production environment so that it picks up the dotenv .env.staging or .env.production files respectively? I can't see anything in the documentation.
thanks
Will https://github.com/laurilehmijoki/s3_website#specifying-the-location-of-your-website help you?
I feel that it would be easier to just have something like --config s3_staging.yml, this way I don't have to create a folder just for a separate configuration
This would also be a big help for me too, I will have a separate config for staging/demo that I would prefer to not store in a separate file. Not at all a showstopper as everything else has worked beautifully.
FYI, and in the meantime, I've had good success with this hack in s3_website.yml:
<%
if ENV['ENV'] == 'production'
@s3_bucket = '...'
@cloudfront_id = '...'
else
@s3_bucket = '...'
@cloudfront_id = '...'
end
%>
...
s3_bucket: <%= @s3_bucket %>
...
cloudfront_distribution_id: <%= @cloudfront_id %>
...
And then you do ENV=production s3_website push or ENV=staging s3_website push
Hey! Thank you for that.
In case I don't have a CloudFront distribution for the staging environment, would the following work?
<%
if ENV['ENV'] == 'production'
@s3_bucket = 'prod.doma.in'
@cloudfront = 'D1S3BUT10NID'
@wildcardinv = true
elsif ENV['ENV'] == 'staging'
@s3_bucket = 'staging.doma.in'
else
@s3_bucket = 'dev.doma.in'
end
%>
s3_bucket: <%= @s3_bucket %>
cloudfront_distribution_id: <%= @cloudfront %>
cloudfront_wildcard_invalidation: <%= @wildcardinv %>
That would essentially return null values for the distribution and wildcard invalidation on non-production builds. Is that valid?
I've posted this question on StackOverflow as well.