Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use APP_ID instead of the non-existing APP_NAME #152

Merged
merged 2 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ The following action deploys the app whenever a new commit is pushed to the main

In this case, a secret of the repository named `SOME_SECRET_FROM_REPOSITORY` will also be passed into the app via its environment variables as `SOME_SECRET`. It is passed to the action's environment via the `${{ secrets.KEY }}` notation and then substituted into the spec itself via the environment variable reference in `value`. Make sure to define the respective env var's type as `SECRET` in the spec to ensure the value is stored in an encrypted way.

**Note:** `APP_DOMAIN`, `APP_URL` and `APP_NAME` are predefined [App-wide variables](https://docs.digitalocean.com/products/app-platform/how-to/use-environment-variables/#app-wide-variables). Avoid overriding them in the action's environment to avoid the env-var-expansion process of the Github Action to interfere with that of the platform itself.
**Note:** `APP_DOMAIN`, `APP_URL` and `APP_ID` are predefined [App-wide variables](https://docs.digitalocean.com/products/app-platform/how-to/use-environment-variables/#app-wide-variables). Avoid overriding them in the action's environment to avoid the env-var-expansion process of the Github Action to interfere with that of the platform itself.

```yaml
name: Update App
Expand Down
2 changes: 1 addition & 1 deletion utils/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
var appWideVariables = map[string]struct{}{
"APP_DOMAIN": {},
"APP_URL": {},
"APP_NAME": {},
"APP_ID": {},
}

// ExpandEnvRetainingBindables expands the environment variables in s, but it
Expand Down
27 changes: 27 additions & 0 deletions utils/env_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,30 @@ func TestExpandEnvRetainingBindables(t *testing.T) {
})
}
}

func TestExpandEnvRetainingBindablesAppWideVariables(t *testing.T) {
markusthoemmes marked this conversation as resolved.
Show resolved Hide resolved
tests := []struct {
name string
in string
out string
}{{
name: "APP_DOMAIN",
in: "${APP_DOMAIN}",
out: "${APP_DOMAIN}",
}, {
name: "APP_URL",
in: "${APP_URL}",
out: "${APP_URL}",
}, {
name: "APP_ID",
in: "${APP_ID}",
out: "${APP_ID}",
}}

for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
got := ExpandEnvRetainingBindables(test.in)
require.Equal(t, test.out, got)
})
}
}
Loading