-
Notifications
You must be signed in to change notification settings - Fork 179
environment variables in Synthetics run from Private locations #3979
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
base: main
Are you sure you want to change the base?
Conversation
…e Locations Added instructions for using environment variables in synthetics run from Private Locations
Clarified the scope of variable accessibility in Private Location.
Clarified the source of the environment variable in the script.
🔍 Preview links for changed docs |
Clarified the use of environment variables with Private Locations and moved warning above the example.
benironside
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some initial edits, but defer to Mike's expertise here.
|
|
||
| :::: | ||
|
|
||
| ### Use environment variables in Synthetics Projects |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ### Use environment variables in Synthetics Projects | |
| ### Use environment variables in synthetics projects |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this suggestion is correct. The rest of the page is consistent in the usage of "Synthetics project"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, Synthetics project seems to be consistent through the docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I was writing Synthetics docs, I would use Synthetics when referring to the Elastic Synthetics product and synthetic when using it as an adjective like synthetic monitors. In this case, I would say it makes more sense to use "Synthetics project" because a "project" is an Elastic-specific concept unlike "monitor", which is generic concept in the world of synthetic monitoring.
| ### Use environment variables with Private Locations | ||
|
|
||
| If you are using Kibana-managed monitors and running them on a Private Location, you can inject environment variables directly into the agent's runtime environment. | ||
| This method allows you to keep sensitive values out of the Kibana UI. Instead, it requires access to the infrastructure hosting the Elastic Agent. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| This method allows you to keep sensitive values out of the Kibana UI. Instead, it requires access to the infrastructure hosting the Elastic Agent. | |
| This method allows you to keep sensitive values out of the {{kib}} UI. Instead, it stores those values on the infrastructure hosting the {{agent}}. |
| This method allows you to keep sensitive values out of the Kibana UI. Instead, it requires access to the infrastructure hosting the Elastic Agent. | ||
|
|
||
| ::::{warning} | ||
| These variables will be accessible to **all** monitors running on **this specific** Private Location. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| These variables will be accessible to **all** monitors running on **this specific** Private Location. | |
| These variables are accessible to all monitors running on this specific Private Location. |
| #### 1. Pass variables to the Private Location | ||
| When starting your Private Location (Elastic Agent) using Docker, use the `--env` flag to pass your variables. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| #### 1. Pass variables to the Private Location | |
| When starting your Private Location (Elastic Agent) using Docker, use the `--env` flag to pass your variables. | |
| #### 1. Pass variables to the Private Location | |
| When starting your Private Location ({{agent}}) using Docker, use the `--env` flag to pass your variables. |
| ``` | ||
|
|
||
| #### 2. Reference variables in the inline script | ||
| In the Synthetics Monitor editor in Kibana, you can now access these variables using `process.env`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| In the Synthetics Monitor editor in Kibana, you can now access these variables using `process.env`. | |
| In the Synthetics **Monitors** editor in {{kib}}, you can now access these variables using `process.env`. |
|
|
||
| If you are managing monitors with a Synthetics project, you can use environment variables in your `synthetics.config.ts` or `synthetics.config.js` file. | ||
|
|
||
| The example below uses `process.env.MY_URL` to reference a variable named `MY_URL` defined in the environment and assigns its value to a param. That param can then be used in both lightweight and browser monitors that are managed in the Synthetics project: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mdbirnstiehl is there a good reason to use param here instead of parameter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I now see the whole page uses params. Not saying it needs to change. Just curious about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so, the setting in Kibana is Global parameters, but you pass --params CLI argument, so I think it would make sense to say either.
Adding instructions for using environment variables in synthetics run from Private Locations