But it complains about token: ERROR can't connect to storage: one of --token-file, --token-stdin or --token must be provided
I’m not sure what the --token or --token-file option is for. Does this relate to the repo password?
I did try pointing the --token-file to config\repository_mgmt.config.kopia-password which contains the bas64 encoded repo password. but no go.
It seems to me that between the config file and provided repo password I have everything required to create a repo but I’m clearly doing something wrong.
The use case here is that I’m generating kopia packages using Ansible. I.e. the config file is being built from a template.
Did you find a solution? I am trying to do same thing but with connecting a repository. This page does not tell how it is done and no help is found arond the web
No, I haven’t unfortunately. I’ve worked around it by writing out the repository.config to its target location then my python deployment script reads the file with json load and builds a “create repo” command which then writes back to the same config file.
The doco could use some improvement. I’ve really no idea what --token or --token-file mean.
Maybe you need to pass the kopia password in the terminal, then create the repo and use the lines I used to connect and create additional snapshots on the command line using a config.
Yes, that’s what I’m doing, but in the documentation, there is a repository create from-config command as per this link: repository create from-config | Kopia
And I would have thought this would allow creating the repo from a config file. Afterall, the config file contains all the required info to do so but I can’t get it to work. Or am I misunderstanding what the command is for?
Thanks Wayland. I’m 99% sure I have dried --file and a whole range of variations but I think the main hang up was the token options which are required. I thought token-file might be the base64 encoded version of the repo password, but suspect I’m way off.
That was what I was trying to get at, the connect option (which was what I needed) seemed to require a token with --config-file until I discarded that and used the --file option, then it stopped complaining about token related stuff and relied only on the actual config file.
Searching the documentation for “token”, the second hit is this: Command Line | Kopia (Quick Reconnection To Repository), which shows where to find the token in the output of the kopia repo status -t command.
If you want to extract the token programmatically, you can use: kopia repository status -t -s | grep token | head -1 | awk '{print $7}'