How does -print-credentials work?

I’ve seen several mentions of the -print-credentials CLI arg being able to be passed to the Web GUI .exe to get the storage credentials but I have been unable to make it work. It either complains about the port being in use, or, if I quit the app, it starts it normally.

I’m also unable to find any documentation about this option.

Does it still work?

1 Like

I think the idea is that you launch the app passing that flag, and then when you run backup, or any other command that involves CLI invocation, it will print credentials it passes to CLI to the console.

% /Volumes/Duplicacy\ Web\ Edition\ 1/Duplicacy\ Web\ Edition.app/Contents/MacOS/duplicacy_web_osx_x64 -print-credentials
Duplicacy Web Edition 1.7.2 (1B2557)
Starting the web server at http://127.0.0.1:3875
Env: DUPLICACY_TEST_PASSWORD=
^C

You don’t really need to jump through all these hoops – since webUI passes credentials through process environment, you can just run the backup and then use tools like htop to view process environment.

Hmm. Okay, thanks for that. So, maybe I should share a bit of background about why I want this…

I’m trying to get the history of a file. This isn’t possible through the Web GUI as far as I can tell, so I have to use the CLI. In order to use the CLI, I have to pass the credentials.

So, I was trying to figure out if I could create a script that would load up the environment variables for me automatically based on the configuration of the Web GUI. That way I can avoid typing them every time or hardcoding them in plaintext in a script. I was hoping I might be able to pipe the output of -print-credentials and stuff it into the right variables, but that isn’t going to work based on what you’re describing.

I guess I can set them globally on my machine/user environment, but, I’d really rather only have them set while I was working with the CLI…

Wouldn’t it be nice if there was an easy way to use the CLI with the Web GUI?

Use CLI once, without defining environment variables. Input the credentials on the console, as requested. Duplicacy will save the credentials to your system keychain. Next time it will retrieve credentials from there.

That sounds nice but it asks me every time for my Backblaze B2 credentials.

Maybe the credentials are saved only during init? Init some fake storage with the same name and will save credentials. Or you can manually put credentials to the keychain and authorize duplicacy to use it. On macOS you can use the security utility. The key names are the same as described in the docs.

So, no way to use the same credentials that are already stored in the Web GUI configuration with the CLI? And no way to view a file’s history in the Web GUI? Very disappointing…

See above how to do it. Extract credentials, import them to keychain and use them.

Indeed, the restore workflow can be improved.

See above how to do it. Extract credentials, import them to keychain and use them.

Extract the credentials by spying on the process or finding them in a log and then init fake storage to store them? I’m not trying to be a jerk, but if that’s the solution then that’s a truly terrible UX.

And, it may be a pedantic distinction, but storing a second copy of the same credentials in a second location is not the same as using the same credentials. If I change/rotate these credentials, I now have to remember to do it in two distinct places.

By starting webui with the flag, running a job, and collecting the credentials from the stdout. This is the way --print-credentials works. It’s intended for cases when user forgot storage credentials to recover them. That’s the only usecase.

WebUI has a lot of shortcomings, but this is not one of them. If you want to use CLI – use CLI. The WebUI is meant to isolate users from implementation details in general and CLI in particular.

The fact that it does not make it easy to mess with implementation details is hardly a shortcoming.

That’s what WebUI does. Literally. It uses credentials it stores in web GUI config with CLI.

I guess I don’t understand what are you trying to accomplish here. Let’s backtrace and start from the beginning – what is the high level problem you are trying to solve? You should not need to extract credentials to begin with.

That’s what WebUI does. Literally. It uses credentials it stores in web GUI config with CLI.

Sure, the Web GUI does that but I cannot run the CLI myself using the credentials stored in the Web GUI to invoke an option that isn’t offered by the Web GUI, can I?

I guess I don’t understand what are you trying to accomplish here. Let’s backtrace and start from the beginning – what is the high level problem you are trying to solve?

I do nightly backups. At some point over the last year a file changed. I need to know when, so I can restore that specific backup. As far as I can tell, this is only possible using the “history” command via the CLI.

I don’t want to use the CLI, but as far as I can tell I’m given no choice if I want to know what versions of a file exist in my backup.