我已安装gcloud
来管理我的CloudSQL实例与GAE应用之间的关系。
我有一些需要连接到其中一个数据库的应用程序,并且我尝试自动化在此数据库上添加新GAE应用程序的过程,作为简化部署过程的一部分。
我试图使用patch
命令,但是对于数组,它会覆盖整个值,所以我需要传递一个完整的数组。除此之外,我无法弄清楚这样做的确切语法。这是我最好的猜测。
$ gcloud sql instances patch projectname:databasename --authorized-gae-apps="testappid1,testappid2"
This command will change the instance settings.
All arrays must be fully-specified. Any previous data in an array will be overwritten with the given list.
The following JSON message will be used for the patch API method.
{'instance': 'test', 'settings': {'authorizedGaeApplications': ['testappid1,testappid2']}}
Do you want to continue (Y/n)? Y
ERROR: (gcloud.sql.instances.patch) ResponseError: status=400, code=Bad Request, reason=invalid
message=Invalid Value
它似乎将应用程序作为字符串发送到数组中,而不是将每个值分开。我尝试了其他一些方法,但我没有尝试过将命令行参数转换为JSON中的多项数组。
如果我做这样的事情(只设置一个应用程序),它可以工作,但它会覆盖完整的值,这不是我想要的:
gcloud sql instances patch projectname:databasename --authorized-gae-apps="testappid1"
如何让gcloud
让我从命令行指定多个授权的GAE应用程序?
答案 0 :(得分:2)
试试这样:
gcloud sql instances patch projectname:databasename --authorized-gae-apps testappid1 testappid2