title | description | author | ms.author | ms.date |
---|---|---|---|---|
Resolve relative paths |
How Dev Proxy resolves relative paths |
garrytrinder |
garrytrinder |
04/08/2024 |
All file paths used in configuration files (devproxyrc.json
) are relative to the location of the configuration file.
In the below example, the pluginPath
is relative to the configuration file. The default devproxyrc.json
configuration file is located in the same location where the plugins
folder exists.
{
"name": "GraphSelectGuidancePlugin",
"enabled": true,
"pluginPath": "~appFolder/plugins/dev-proxy-plugins.dll",
"urlsToWatch": [
"https://graph.microsoft.com/v1.0/*",
...
]
}
Let's say you start the proxy from a different directory, such as from the location of a project you're working in.
If an devproxyrc.json
configuration file exists in the current directory, then the file path resolution is relative to this file. If not, the proxy falls back to the default devproxyrc.json
file.
Using a configuration file that isn't located in the proxy installation directory requires you to ensure that plugin paths are resolved correctly.
Use the ~appFolder
token in the file paths to ensure that the path is prepended with the absolute path to the proxy installation directory.
{
"name": "GraphSelectGuidancePlugin",
"enabled": true,
"pluginPath": "~appFolder/plugins/dev-proxy-plugins.dll",
"urlsToWatch": [
"https://graph.microsoft.com/v1.0/*",
...
]
}
The ~appFolder
token can be used in any path used by the proxy.
Let's say you want to load a preset configuration, you can use the ~appFolder
token in the path to reference the configuration file located in the proxy installation directory.
devproxy --config-file ~appFolder/presets/microsoft-graph.json