Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
add docs for single and list secrets functions for agent
Maidul Islamcea1a5e7ea64
diff --git a/cli/packages/cmd/agent.go b/cli/packages/cmd/agent.goindex 537131bc29..59e496ec7f 100644--- a/cli/packages/cmd/agent.go+++ b/cli/packages/cmd/agent.go@@ -375,7 +375,8 @@ func ProcessTemplate(templateId int, templatePath string, data interface{}, accedynamicSecretFunction := dynamicSecretTemplateFunction(accessToken, dynamicSecretManager, templateId)getSingleSecretFunction := getSingleSecretTemplateFunction(accessToken, existingEtag, currentEtag)funcs := template.FuncMap{- "secret": secretFunction,+ "secret": secretFunction, // depreciated+ "listSecrets": secretFunction,"dynamic_secret": dynamicSecretFunction,"getSecretByName": getSingleSecretFunction,"minus": func(a, b int) int {diff --git a/docs/integrations/platforms/infisical-agent.mdx b/docs/integrations/platforms/infisical-agent.mdxindex b397b73529..bb12612086 100644--- a/docs/integrations/platforms/infisical-agent.mdx+++ b/docs/integrations/platforms/infisical-agent.mdx@@ -252,7 +252,7 @@ To install the Infisical agent, you must first install the [Infisical CLI](../clOnce you have the CLI installed, you will need to provision programmatic access for the agent via [Universal Auth](/documentation/platform/identities/universal-auth). To obtain a **Client ID** and a **Client Secret**, follow the step by step guide outlined [here](/documentation/platform/identities/universal-auth).-Next, create agent config file as shown below.+Next, create agent config file as shown below. The example agent configuration file that defines the token authentication method, one sink location, and a secret template.```yaml example-agent-config-file.yamlinfisical:@@ -277,8 +277,8 @@ templates:command: ./reload-app.sh```-Above is an example agent configuration file that defines the token authentication method, one sink location (where to deposit access tokens after renewal) and a secret template.-+The secret template below will be used to render the secrets with the key and the value separated by `=` sign. You'll notice that a custom function named `secret` is used to fetch the secrets.+This function takes the following arguments: `secret "<project-id>" "<environment-slug>" "<secret-path>"`.```text my-dot-ev-secret-template{{- with secret "6553ccb2b7da580d7f6e7260" "dev" "/" }}@@ -288,11 +288,42 @@ Above is an example agent configuration file that defines the token authenticati{{- end }}```-The secret template above will be used to render the secrets where the key and the value are separated by `=` sign. You'll notice that a custom function named `secret` is used to fetch the secrets.-This function takes the following arguments: `secret "<project-id>" "<environment-slug>" "<secret-path>"`.+After defining the agent configuration file, run the command below pointing to the path where the agent configuration file is located.+```bashinfisical agent --config example-agent-config-file.yaml```-After defining the agent configuration file, run the command above pointing to the path where the agent configuration is located.++### Available secret template functions+<Accordion title="listSecrets">+ ```bash+ listSecrets "<project-id>" "environment-slug" "<secret-path>"+ ```+ ```bash example-template-usage+ {{- with listSecrets "6553ccb2b7da580d7f6e7260" "dev" "/" }}+ {{- range . }}+ {{ .Key }}={{ .Value }}+ {{- end }}+ {{- end }}+ ```+ This function can be used to render the full list of secrets within a given project, environment and secret path.++</Accordion>++<Accordion title="getSecretByName">+ ```bash+ getSecretByName "<project-id>" "<environment-slug>" "<secret-path>" "<secret-name>"+ ```++ ```bash example-template-usage+ {{ with getSecretByName "d821f21d-aa90-453b-8448-8c78c1160a0e" "dev" "/" "POSTHOG_HOST"}}+ {{ if .Value }}+ password = "{{ .Value }}"+ {{ end }}+ {{ end }}+ ```++ This function can be used to render a single secret by it's name.+</Accordion>