I've written an Golang program designed to is parse a scv file and upload data to FireStore, this program was build to share with people who just write scv path to upload info.
I'm using this to use firebase-admin:
opt := option.WithCredentialsFile("path/to/serviceAccountKey.json")
This approach works fine when I do:
$ go run main.go
but when I build the project and execute the binary I got this:
$ cannot read credentials file: open firebase-config.json: no such file or directory
I did read this approach but it means share firebase-config.json too, the idea of this Go program is just share the executable without any doc else.
Is there a way to build the program including the json or authenticate firebase-admin using json directly like this?:
opt := option.WithCredentials({< authentication json >})
I have no found documentation or examples using this method WithCredential.
I don't know if this is the best way to solve this but this is the way I did it:
So, now I can do this:
var file string = "/opt/< dir-name >/auth.json"
sa := option.WithCredentialsFile(file)
Now I can share this script with the directive "Install into /opt/< dir-name>/bin and add this to your $PATH"