Skip to content

Commit

Permalink
add environment variables related to connections
Browse files Browse the repository at this point in the history
Signed-off-by: Will Tsai <[email protected]>
  • Loading branch information
willtsai committed Aug 7, 2023
1 parent 03fad8e commit e7440a4
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/content/author-apps/container/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ Refer to the probes section of the [container resource schema]({{< ref "containe

Connections enable communication between your container and other resources, such as databases, message queues, and other services. A connection injects information about the resource you connect to as environment variables. This could be connection strings, access keys, password or other information needed for communication between the container and the resource it connects to. It also enables you to configure the RBAC permissions for the container to access the resource.

Refer to the [connections schema] for containers({{< ref "container-schema#connections" >}}) for more details.
Refer to the [connections schema for containers]({{< ref "container-schema#connections" >}}) for more details.

### Extensions

Expand Down
2 changes: 1 addition & 1 deletion docs/content/concepts/application-graph/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ For example, if you want a container to read from an Azure Storage Account witho

<img src="graph-automation.png" alt="A diagram showing a connection from a Radius container to an Azure storage account resulting in managed identities, role-based access control, and CSI drivers." width=600px >

### Injected values
### Connections and injected values

The mechanism behind this automated application deployment is injected values into environment variables. When a connection between two resources is declared, Radius injects resource related information into environment variables that are then used to access the respective resource without having to hard code URIs, connection strings, access keys, or anything that application code needs to successfully communicate. Refer to the [reference documentation]({{< ref resource-schema >}}) of each resource for more information.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,14 @@ When no Recipe configuration is set, Radius will use the currently registered Re

### Provision manually

If you want to manually manage your infrastructure provisioning without the use of Recipes, you can set `resourceProvisioning` to `'manual'` and provide all necessary parameters and values that enable Radius to deploy or connect to the desired infrastructure.
If you want to manually manage your infrastructure provisioning without the use of Recipes, you can set `resourceProvisioning` to `'manual'` and provide all necessary parameters and values that enable Radius to deploy or connect to the desired infrastructure.

## Environment variables for connections

Other Radius resources, such as [containers]({{< ref "container" >}}), may connect to a Redis resource via [connections]({{< ref "application-graph#connections-and-injected-values" >}}). When a connection to Redis is declared, Radius injects values into environment variables that are then used to access the connected Redis resource:

| Environment variable | Description | Example(s) |
|----------------------|-------------|------------|
| CONNECTION_MYCONNECTION_USERNAME | The username for the Redis cache. | `admin` |
| CONNECTION_MYCONNECTION_CONNECTIONSTRING | The connection string for the Redis cache. | `https://mycache.redis.cache.windows.net,password=*****,....` |
| CONNECTION_MYCONNECTION_PASSWORD | The password for the Redis cache. | `mypassword` |
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,16 @@ When no Recipe configuration is set Radius will use the Recipe registered as the

### Provision manually

If you want to manually manage your infrastructure provisioning outside of Recipes, you can set `resourceProvisioning` to `'manual'` and provide all necessary parameters and values and values that enable Radius to deploy or connect to the desired infrastructure.
If you want to manually manage your infrastructure provisioning outside of Recipes, you can set `resourceProvisioning` to `'manual'` and provide all necessary parameters and values and values that enable Radius to deploy or connect to the desired infrastructure.

## Environment variables for connections

Other Radius resources, such as [containers]({{< ref "container" >}}), may connect to a Azure SQL resource via [connections]({{< ref "application-graph#connections-and-injected-values" >}}). When a connection to Azure SQL is declared, Radius injects values into environment variables that are then used to access the connected Azure SQL resource:

| Environment variable | Description | Example(s) |
|----------------------|-------------|------------|
| CONNECTION_MYCONNECTION_DATABASE | The name of the target Azure SQL database. | `mydatabase` |
| CONNECTION_MYCONNECTION_SERVER | The fully qualified domain name of the target Azure SQL server. | `sql.hello.com` |
| CONNECTION_MYCONNECTION_USERNAME | The username for the target Azure SQL database. | `admin` |
| CONNECTION_MYCONNECTION_PASSWORD | The password for the target Azure SQL database. | `mypassword` |
| CONNECTION_MYCONNECTION_CONNECTIONSTRING | The connection string for the target Azure SQL database. | `https://mysqlserver.cluster.svc.local,password=*****,....` |
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,15 @@ Parameters can also optionally be specified for the Recipe.

### Provision manually

If you want to manually manage your infrastructure provisioning outside of Recipes, you can set `resourceProvisioning` to `'manual'` and provide all necessary parameters and values in order for Radius to be able to deploy/connect to the desired infrastructure.
If you want to manually manage your infrastructure provisioning outside of Recipes, you can set `resourceProvisioning` to `'manual'` and provide all necessary parameters and values in order for Radius to be able to deploy/connect to the desired infrastructure.

## Environment variables for connections

Other Radius resources, such as [containers]({{< ref "container" >}}), may connect to a MongoDB resource via [connections]({{< ref "application-graph#connections-and-injected-values" >}}). When a connection to MongoDB is declared, Radius injects values into environment variables that are then used to access the connected MongoDB resource:

| Environment variable | Description | Example(s) |
|----------------------|-------------|------------|
| CONNECTION_MYCONNECTION_DATABASE | Name of the target Mongo database | `mongodb-prod` |
| CONNECTION_MYCONNECTION_USERNAME | Username for the target Mongo database | `myusername` |
| CONNECTION_MYCONNECTION_PASSWORD | Password for the target Mongo database | `mypassword` |
| CONNECTION_MYCONNECTION_CONNECTIONSTRING | Connection string for the target Mongo database | `https://mymongo.cluster.svc.local,password=*****,....` |
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,15 @@ When no Recipe configuration is set Radius will use the Recipe registered as the

### Provision manually

If you want to manually manage your infrastructure provisioning outside of Recipes, you can set `resourceProvisioning` to `'manual'` and provide all necessary parameters and values and values that enable Radius to deploy or connect to the desired infrastructure.
If you want to manually manage your infrastructure provisioning outside of Recipes, you can set `resourceProvisioning` to `'manual'` and provide all necessary parameters and values and values that enable Radius to deploy or connect to the desired infrastructure.

## Environment variables for connections

Other Radius resources, such as [containers]({{< ref "container" >}}), may connect to a RabbitMQ resource via [connections]({{< ref "application-graph#connections-and-injected-values" >}}). When a connection to RabbitMQ is declared, Radius injects values into environment variables that are then used to access the connected RabbitMQ resource:

| Environment variable | Description | Example(s) |
|----------------------|-------------|------------|
| CONNECTION_MYCONNECTION_QUEUE | The name of the target RabbitMQ queue. | `'orders'` |
| CONNECTION_MYCONNECTION_USERNAME | The username for the target RabbitMQ queue. | `'guest'` |
| CONNECTION_MYCONNECTION_CONNECTIONSTRING | The connection string to the target RabbitMQ queue. | `'amqp://guest:***@rabbitmq.svc.local.cluster:5672'` |
| CONNECTION_MYCONNECTION_PASSWORD | The password for the target RabbitMQ queue. | `'password'` |

0 comments on commit e7440a4

Please sign in to comment.