A plugin for Insomnia which automatically fetches a token from the Lagoon GraphQL API, in the manner described in the docs.
Either:
insomnia://plugins/install?name=insomnia-plugin-lagoon-token
insomnia-plugin-lagoon-token
as the Package to installIn case there's an error when installing as above, go into the plugins directory and run npm install insomnia-plugin-lagoon-token
manually.
Create an environment and set the Lagoon GraphQL API endpoint:
{
"lagoon_graphql_url": "https://api.lagoon.amazeeio.cloud/graphql"
}
If you have already set up your ~/.ssh/id_ed25519
or ~/.ssh/id_rsa
to talk to Lagoon, skip to step 4.
Create an Environment using the following template:
{
"lagoon_graphql_url": "https://api.lagoon.amazeeio.cloud/graphql",
"lagoon_graphql_token": "[your-token]", # Not required nor recommended.
"lagoon_ssh_host": "ssh.lagoon.amazeeio.cloud",
"lagoon_ssh_port": 32222,
"lagoon_ssh_private_key": "/your/user/home/.ssh/id_ed25519"
}
You can also specify an SSH agent:
{
"lagoon_ssh_auth_sock": "/your/custom/agent.sock"
}
Create a request with url {{ _.lagoon_graphql_url }}
and set the environment created in step 1. Make sure to check Enabled in the Bearer tab, but leave the TOKEN empty.
The plugin will fetch the token (when lagoon_graphql_token
is not provided) and add it as a bearer token to the header. The Content-Type
header is also set to application/json
automatically.
Profit.
The plugin expects the following variables in the environment:
https://api.lagoon.amazeeio.cloud/graphql
ssh.lagoon.amazeeio.cloud
32222
[^1]: Defaults are taken from the Lagoon GraphQL documentation. [^2]: Adding an SSH key to your Lagoon user: https://docs.lagoon.sh/using-lagoon-advanced/ssh/