Support Custom URLS
raksiv opened this issue ยท 7 comments
Developers would like to be able to configure custom urls for apis instead of using the auto generated addresses.
Currently looking at implementing this at the providers, starting with the AWS provider. Because URLs will be expected to differ between environments this will be stack level configuration.
Proposal for AWS configuration:
name: my-aws-stack
provider: nitric/aws@0.30.0
region: ap-southeast-2
# Add a key for configuring apis
apis:
# Target an API by its nitric name
my-api-name:
# provide a domain to be used for the api
domain: test.example.com
Current assumptions for AWS is that the certificate for the domain will already be managed in ACM with a managed zone in route 53. Domains will be discovered by searching for the domain using the provided name to locate a valid certificate.
I am sure this will be a great addition!
If I may make a suggestion. I really like the way that sst does custom API domains, only expecting a hosted zone for the root domain and letting the certificate be managed by the stack docs.
Although I suspect that you are already familiar with sst and how they manage these things so feel free to disregard if that is the case.
Also +1 for making it easy to change domain name based on env.
Hey @JimLundin thanks for the feedback! We'll look at adding the automated certificate management in another release, I think that's a great suggestion to make it easier to use. We'll likely release this proposed solution from @tjholm soon, let us know if you think we're missing anything else here.
I've got an initial working implementation here: #468
Will definetely add more automation to this as we go, I think the cert automation make heaps of sense, can do this if we do the zone lookup first, this should also be compatible with the existing configuration. Requiring a hosted zone to exist in Route53 makes the most sense when deploying to AWS, running the automation under this assumption also simplifies things quite a bit :).
Actually went ahead and automated the certificate creation in: #468 as it does simplify things quite a bit when we can assume that the parent domain is managed in route53.
This is now available v0.30.0-rc.4 of the AWS provider for testing and feedback.
Release in v0.30.0 AWS provider