小编Edu*_*uez的帖子

构建 golang,包括 firebase 凭证文件 .json

我编写了一个 Golang 程序,旨在解析 scv 文件并将数据上传到 FireStore,该程序的构建是为了与只编写 scv 路径来上传信息的人共享。

我用它来使用 firebase-admin:

opt := option.WithCredentialsFile("path/to/serviceAccountKey.json")
Run Code Online (Sandbox Code Playgroud)

当我这样做时,这种方法效果很好:

$ go run main.go
Run Code Online (Sandbox Code Playgroud)

但是当我构建项目并执行二进制文件时,我得到了这个:

$ cannot read credentials file: open firebase-config.json: no such file or directory 
Run Code Online (Sandbox Code Playgroud)

我确实读过这种方法,但这也意味着共享firebase-config.json,这个 Go 程序的想法只是共享可执行文件,没有任何其他文档。

有没有办法构建包含 json 的程序或像这样直接使用 json 验证 firebase-admin ?:

opt := option.WithCredentials({< authentication json >})
Run Code Online (Sandbox Code Playgroud)

我没有找到使用此方法WithCredential的文档或示例。

go firebase firebase-authentication go-build

5
推荐指数
1
解决办法
4017
查看次数

标签 统计

firebase ×1

firebase-authentication ×1

go ×1

go-build ×1