Reason
In order to be safely able to share the files with the queries used by this plugin, it is necessary to add support for environment variables.
That way, it will not be needed to erase sensitive data before pushing the files to a repository our sharing it in other ways.
How it would work
You would put the environment variables in the metadata of a query. It would start with the character $, (the same way variables are represented in graphql):
# variables: {
# "code": "$CODE"
# }
query Country($code: ID!) {
country(code: $code) {
code
name
}
}
The plugin would try to find the file where the variables are set in a list called env_paths. This list would be configured in the plugin's setup function.
gql.setup {
filetypes = { 'graphql' },
keymaps = {
run = '<leader>rr',
},
env_pats = { "path/to/.env" }
}
The paths in the list could be absolute or relative to the file being executed.
Error or no error
- If there is no environment variable found in the query metadata, there is no need to read the .env_file;
- If the environment variable is not found in the .env_file, it is not substituted and no error is shown;
- If the .env_file is not found, no environment variable is substituted and no error is shown;
Reason
In order to be safely able to share the files with the queries used by this plugin, it is necessary to add support for environment variables.
That way, it will not be needed to erase sensitive data before pushing the files to a repository our sharing it in other ways.
How it would work
You would put the environment variables in the metadata of a query. It would start with the character
$, (the same way variables are represented in graphql):The plugin would try to find the file where the variables are set in a list called
env_paths. This list would be configured in the plugin's setup function.The
pathsin the list could beabsoluteorrelativeto the file being executed.Error or no error