Sq.exe config add

Hi Sebastian,

I’m working on automating a backup using the Squidex CLI.

I’ve followed the instructions from here: Automation Tools (CLI) | Squidex

Where it says:

The CLI can manage multiple configurations, so you don’t have to define the App, client and secret for each command. Configurations are stored in a file that is located just next to the CLI, so you need to write permissions to this directory.

I have successfully created a new configuration. I have verified it by running sq.exe confit list. But I cannot seem to find the file that is mentioned in the docs. Where does it end up? It’s not in my folder where I have sq.exe. and it’s not there as a hidden file either. Or is the config stored in memory or something?

Thanks!

This has been changed and the docs are not up to date.

The config is stored in the user directory. There is a subfolder called .sq that has the config.

I found it, thanks. It’s called .sqcli btw.

1 Like

Bumped into another problem.

I’m using Azure Functions to execute my backup automation PowerShell script. In the script I do:

$output = & $squidexCLIPath config add my-app my-app:my-client $env:SquidexClientSecret

This works on my local windows machine (since I have access to the entire file system including the folder where .sqcli folder lives) but it does not work on the Windows machine that hosts my Azure Functions app (because there I don’t have access to C:\Users\johndoe\.sqcli).

Is there some way around this? Or would a --config-path flag be needed in the CLI where you can specify a custom path to the .sqcli folder?

I tried this but it does not seem to work:

.\sq.exe backup create backup.zip my-app my-app:my-client <secret>

You have to use 2 commands:

.\sq.exe config add my-app ...
.\sq.exe backup create

About the config: There is a env variable:

Yes, this is what I am doing currently and it works:

.\sq.exe config add my-app ...
.\sq.exe backup create

I will check out the SQCLI_FOLDER environment variable.

I added SQCLI_FOLDER C:\home\site\wwwroot\tools as an app setting in my Azure Functions app but I’m still getting a:

ERROR: Failed to save configuration file.

Maybe the path needs to be relative and not absolute or something?

I changed it to c:\home\site\wwwroot since this folder has write permissions. I’m still getting this error message however: ERROR: Failed to save configuration file.

And here you can see that the env var is set properly in my function app:

This:

$sqcliFolder = $env:SQCLI_FOLDER
if (-not $sqcliFolder) {
    Write-Host "Environment variable SQCLI_FOLDER not found."
} else {
    Write-Host "Using folder from environment variable SQCLI_FOLDER: $sqcliFolder"
}

results in:

2025-01-09T18:27:00.015 [Information] INFORMATION: Using folder from environment variable SQCLI_FOLDER: C:\home\site\wwwroot

Got any clues?

It seems you have to use c:/home/data folder in an Azure Function app in order to be able to write to the OS.

1 Like

You can close this thread now, everything is working fine. Thanks for all the help!

1 Like