Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
All relative file paths used in configuration files (devproxyrc.json) are relative to the location of the configuration file. Paths that start with ~/ resolve to your home directory.
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/DevProxy.Plugins.dll",
"urlsToWatch": [
"https://graph.microsoft.com/v1.0/*",
...
]
}
The ~appFolder token
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/DevProxy.Plugins.dll",
"urlsToWatch": [
"https://graph.microsoft.com/v1.0/*",
...
]
}
The ~appFolder token can be used in any path used by the proxy.
The ~dataFolder token
The ~dataFolder token resolves to the Dev Proxy user data directory. This folder is separate from the installation directory and isn't affected by upgrades. Configs downloaded with devproxy config get are stored in this folder.
devproxy --config-file ~dataFolder/configs/my-preset/devproxyrc.json
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/config/microsoft-graph.json
The home directory shortcut
A path that starts with ~/ resolves to your home directory instead of the location of the configuration file. On Windows, you can also use ~\. Use this shortcut to reference files that you keep in your home directory, such as shared mock files.
{
"mocksPlugin": {
"$schema": "https://raw.githubusercontent.com/dotnet/dev-proxy/main/schemas/v4.0.0/mockresponseplugin.schema.json",
"mocksFile": "~/mocks/mocks.json"
}
}
The shortcut works in any path used by the proxy, including the --config-file option:
devproxy --config-file "~/devproxy/devproxyrc.json"
Dev Proxy expands only a leading ~/. It doesn't expand ~ on its own, ~ followed by a name such as ~mocks/mocks.json, or ~ in the middle of a path such as mocks/~/mocks.json.