serverless-components / fullstack-app

⚡ Ready-to-use, serverless, full-stack application built with AWS Lambda, Express.js, React, AWS DynamoDB and AWS HTTP API.
https://www.serverless.com
320 stars 70 forks source link

More detail on changing domain name #9

Open jamesladd opened 4 years ago

jamesladd commented 4 years ago

This is looking really good and its very fast to run. Thank you.

I followed the doc to make a .env file for each of my stages. I'm also hoping to have a domain specific for the stage, like test.api.domain.com or api.test.domain.com but this is causing certificate issues etc

A simple domain like mydomain.com works great, and I get a site at www.mydomain.com and an api at api.mydomain.com

Please can you provide more information / examples on customising the domain for different stages?

eahefnawy commented 4 years ago

Have you tried the following?

# .env.dev
DOMAIN=dev.example.com
# .env.prod
DOMAIN=example.com

component: website
name: my-website

inputs:
  src: ./src
  domain: ${env:DOMAIN}

When you run sls deploy --stage dev, the .env.dev file will be picked up, when you run sls deploy --stage prod, the .env.prod will be picked up.