Configure Application Links
Distr allows you to define dynamic application links that automatically resolve to the correct URL after deployment. This enables users to quickly access their deployed applications directly from the Distr interface.
In this guide, you’ll learn how to configure application links using Go template syntax with deployment-specific values.
What are Application Links?
Section titled “What are Application Links?”Application links are templated URLs that point to your deployed application. Instead of hardcoding a URL, you can use template variables that get replaced with actual values from the deployment’s environment variables and configuration.
For example, if your application’s URL depends on a custom hostname configured during deployment, you can create a template like:
https://{{ .Env.HOSTNAME }}When the deployment is created with HOSTNAME=app.example.com, the link automatically becomes https://app.example.com.
How to Configure an Application Link
Section titled “How to Configure an Application Link”Application links are configured when creating or editing an application version in Distr.
- Navigate to the Applications section in the Distr web interface
- Select your application or create a new one
- When creating or editing a version, enter the Application Link in the designated field
- Use Go template syntax with available template variables
The link will be displayed in the deployment card with an “Open” button when the link is non-empty.
Available Template Variables
Section titled “Available Template Variables”Application links support two categories of template variables:
Environment Variables (.Env)
Section titled “Environment Variables (.Env)”Access environment variables defined in the deployment’s .env file:
{{ .Env.VARIABLE_NAME }}Example: If your .env file contains APP_HOST=myapp.example.com, you can use:
https://{{ .Env.APP_HOST }}Helm Values (.Values)
Section titled “Helm Values (.Values)”For Kubernetes deployments, access values from the Helm values YAML:
{{ .Values.path.to.value }}Example: If your values.yaml contains:
ingress: enabled: true host: myapp.example.comYou can use:
https://{{ .Values.ingress.host }}Template Syntax Examples
Section titled “Template Syntax Examples”Application links use Go’s text/template syntax, which supports various operations:
Basic Variable Substitution
Section titled “Basic Variable Substitution”https://{{ .Env.HOST }}:{{ .Env.PORT }}With .env:
HOST=localhostPORT=8080Result: https://localhost:8080
Nested Values
Section titled “Nested Values”For accessing nested YAML structures, use dot notation for nested objects, and use the index function when you need to access array elements by position. For example, to access the first host entry, use:
https://{{ index .Values.app.ingress.hosts 0 "host" }}With values.yaml:
app: ingress: hosts: - host: myapp.example.comResult: https://myapp.example.com
Conditionals
Section titled “Conditionals”Use if statements to handle optional configurations:
https://{{ if .Values.ingress.enabled }}{{ .Values.ingress.host }}{{ else }}localhost{{ end }}With values.yaml:
ingress: enabled: true host: production.example.comResult: https://production.example.com
If ingress.enabled is false, it would use https://localhost.
Best Practices
Section titled “Best Practices”- Use descriptive variable names: Make it clear what each variable represents in your environment template
- Test your templates: Deploy the application to verify the link resolves correctly
- Provide defaults: Use conditionals to provide sensible defaults when optional values are missing
- Document requirements: In your application description, document which environment variables or Helm values are required for the link to work
- Handle protocols: Include the protocol (http/https) in the template or as a variable
Error Handling
Section titled “Error Handling”If a template fails to parse or execute, Distr will:
- Log the error for debugging
- Keep the original template string as the link
- Continue processing other deployments
Missing or undefined variables will render as <no value> in the final URL.
Updating Application Links
Section titled “Updating Application Links”When you update an application link in an application version:
- The change applies to new deployments of that version
- Existing deployments are not automatically updated
- Users can redeploy to pick up the updated link template
To update links for existing deployments, users need to trigger a redeployment of the application.