gentle-umbrella-55872
02/27/2025, 7:33 PMmicroscopic-river-74022
02/27/2025, 7:33 PMmicroscopic-river-74022
02/27/2025, 7:33 PMproject.garden.yml
):
yaml
proxy:
hostname: localhost
2. When you run garden deploy --sync
, Garden will create port forwards for your services. The exact URL will depend on how you've configured your services and ingresses.
3. To access this URL programmatically, you can use Garden's template strings in your configuration. For example, in your service's garden.yml
file, you could set an environment variable like this:
yaml
kind: Deploy
name: your-service
type: container
# ...
spec:
env:
SERVICE_URL: <http://${var.base-hostname}>
Here, ${var.base-hostname}
will resolve to the hostname you've configured (default is "localhost").
4. If you need a specific port, you can reference it from the service configuration, for example:
yaml
SERVICE_URL: <http://${var.base-hostname}:${this.ports.main.localPort}>
This assumes you have a port named "main" defined in your service configuration.
Remember that the exact configuration might vary depending on your specific setup and requirements. The local.demo.garden
domain is often used in Garden examples and resolves to 127.0.0.1, as mentioned in the [FAQ]().
If you need more specific guidance, you might want to check the [Garden documentation on code synchronization]() for detailed examples and best practices.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------microscopic-river-74022
02/27/2025, 7:33 PMgentle-umbrella-55872
02/27/2025, 7:35 PMmicroscopic-river-74022
02/27/2025, 7:43 PMgentle-umbrella-55872
02/27/2025, 7:43 PMyaml
env:
- name: NEXTAUTH_URL
value:
$if: ${actions.deploy.admin.mode == "sync"}
$then: http://localhost:${actions.deploy.admin.outputs.forwardablePorts[0].preferredLocalPort}
$else: https://admin.${var.hostname}
microscopic-river-74022
02/27/2025, 7:44 PM