SAP Tech Bytes: btp CLI – new home for configuration
Be informed about updates to where the btp CLI configuration is stored by default.
This post relates directly to the SAP Tech Bytes: btp CLI – managing configuration post, and provides a brief update to the information in there.
Since that post, the btp CLI has gone through a number of updates. One of these updates has been to where configuration is stored (and looked for) by default. This is independent of your runtime environment; while the previous post showed an example in the SAP Business Application Studio (App Studio), this update applies to all contexts where you run the latest version of the btp CLI.
At the time of writing, according to the information in the canonical home for the btp CLI, the latest version of the btp CLI is 2.14.0:
This is also what the
getbtpcli script reports (see SAP Tech Bytes: btp CLI – installation for more on this utility):
; getbtpcli --test Version is 2.14.0
The main btp CLI configuration is stored in a file called
config.json. There are sometimes other files that contain configuration too, and these, along with
config.json, are stored by default in a directory called
In the past, the default location for this
.btp/ directory was in a
.cache/ directory in your home directory. So for me, while working in my local dev container, would have been, previously:
# /home/user ; tree .cache/.btp .cache/.btp |-- autocomplete | `-- scripts | `-- sapbtpcli-autocomplete.plugin.sh `-- config.json
(here you can see examples of other files alongside
There is now a new default location.
.cache/, the default location for
.btp/ is now
.config/. So now it looks like this:
# /home/user ; tree .config/.btp .config/.btp |-- autocomplete | `-- scripts | `-- sapbtpcli-autocomplete.plugin.sh `-- config.json
This is a great move because it aligns with the XDG Base Directory Specification which I mentioned in the previous post.
New environment variable
Not only has the default location changed from
.config/, but also the environment variable that you can set to tell the btp CLI where your configuration is, has changed too.
Previous it was
SAPCP_CLIENTCONFIG. This reflected the name of the btp CLI at the time (
It is now
BTP_CLIENTCONFIG, which reflects the current name of the btp CLI of course.
My configuration location
As I mentioned in the SAP Tech Bytes: btp CLI – managing configuration post, I like to organise my configuration directories within my
XDG_CONFIG_HOME location (i.e.
$HOME/.config/) according to the name of the tool or utility, but as normal directories, rather than hidden ones (the period at the start of the
.btp/ directory name means that it is to be treated as a hidden directory).
This is what the contents of my
$HOME/.config/ directory looks like:
; ls .config ./ btp/ g/ htop/ procps/ tmuxinator/ ../ configstore/ gcloud/ kitty/ ranger/ vim/ asciinema/ docker/ gh/ lf/ so/ weechat/ autocomplete/ exercism/ gitui/ newsboat/ stack/ yamllint/
Note that my btp CLI configuration directory is not hidden, i.e. it’s
btp/ rather than
.btp/. That’s my personal choice, and I use the
BTP_CLIENTCONFIG environment variable to tell the btp CLI that this is where I have my configuration:
If you’re still using
SAPCP_CLIENTCONFIG, don’t worry – there’s a grace period; the btp CLI will still honour the use of this environment variable, to give you time to change over to
BTP_CLIENTCONFIG. But I’d encourage you to do that soon!
SAP Tech Bytes is an initiative to bring you bite-sized information on all manner of topics, in video and written format. Enjoy!