Using a Config File
If you find yourself regularly entering the same arguments into the Meraki-CLI tool like your API key, debug level, logfile, etc, it might make sense to save those settings to a static config file in a permanent location.
The Meraki-CLI tool supports the use of a config file to provide any of its arguments. The config file should contain proper JSON syntax and should be a simple object (Python dictionary) in format. An example is shown below.
Get Config File Settings From Command
If you want to use the arguments of a currently working command for your config file, set a maximum debug level of -ddd
and copy/paste the JSON output under the "Argument Settings" log statement.
Config File Location¶
The config file can be obtained by the program by either explicitly defining its location using the -c
option like -c ~/meraki-cli.conf
, or by placing the file in a location searched by Meraki-CLI upon program start. The search locations are provided below.
The below file paths are searched in this order for a Meraki-CLI config file on Linux or WSL.
./meraki-cli.conf
(current working directory)~/.meraki-cli/meraki-cli.conf
(hidden directory in user's home directory)/etc/meraki-cli/meraki-cli.conf
The below file paths are searched in this order for a Meraki-CLI config file on MacOS.
./meraki-cli.conf
(current working directory)~/.meraki-cli/meraki-cli.conf
(hidden directory in user's home directory)~/Library/Application Support/meraki-cli/meraki-cli.conf
The below file paths are searched in this order for a Meraki-CLI config file on native Windows.
-
%APPDATA%\meraki-cli\meraki-cli.conf
-
The
The%APPDATA%
Directory%APPDATA%
directory is usually equal toC:\Users\<username>\AppData\Roaming
by default. Assuming the default, the config file location would be:C:\Users\<username>\AppData\Roaming\meraki-cli\meraki-cli.conf
-
-
%LOCALAPPDATA%\meraki-cli\meraki-cli.conf
-
The
The%LOCALAPPDATA%
Directory%LOCALAPPDATA%
is usually equal toC:\Users\<username>\AppData\Local
by default. Assuming the default, the config file location would be:C:\Users\<username>\AppData\Local\meraki-cli\meraki-cli.conf
-
All Paths are Searched
Any of the above locations except /etc/meraki-cli/meraki-cli.conf
will work on any platform.
- The
APPDATA
andLOCALAPPDATA
environment variables exist on Windows by default, but can be added to any machine - The two
~
(home) locations will resolve on both Windows or MacOS/Linux to a subdirectory inside the user's home directory.
Example meraki-cli.conf
Config File¶
Creating Your Config File¶
- Create the hidden
.meraki-cli
directory in your home directory - Create a new file called
meraki-cli.conf
in the new directory - Copy and paste the contents of the example file from above into the editor
- Edit the API key and change/remove other settings if desired
- Use CTRL-X to prompt for exit
- Press the "Y" key to save the file
- Press ENTER to confirm the file name
- Open a text editor
- Create a new text file at path:
C:\Users\<username>\AppData\Roaming\meraki-cli\meraki-cli.conf
- Copy and paste the contents of the example file from above into the editor
- Edit the API key and change/remove other settings if desired
- Save the file