AKd*_*AKd 5 firebase-security firebase-storage
我想描述一个.rules文件中多个桶的存储安全规则。存储桶名称事先未知,但域名存储桶的前缀是已知的。
假设我有以下桶:
uploads.<root-domain>original.<root-domain>edited.<root-domain>我知道我可以使用部署目标并将每条规则放入其自己的文件中,但我希望将所有规则放在一个文件中。是的,我将定义一个包含所有存储桶的部署目标,并使用我的单个.rules文件分配该目标。
我尝试过以下方法。
service firebase.storage {
// Original audio files
match /b/original.{root}/o {
match /{allPaths=**} {
allow read;
}
}
// Uploads
match /b/uploads.{root}/o {
match /{uploadCode}/{file=**} {
allow read, write;
}
}
}
Run Code Online (Sandbox Code Playgroud)
但部署时出现错误:
Error: Compilation errors in storage.rules:
[E] 4:22 - Unexpected 'rootdomain'.
[E] 4:9 - Missing 'match' keyword before path.
[E] 4:22 - Unexpected 'rootdomain'.
[E] 4:33 - Missing 'match' keyword before path.
[E] 5:5 - missing '}' at 'match'
[E] 11:3 - Unexpected 'match'.
Run Code Online (Sandbox Code Playgroud)
因此,通配符似乎仅适用于整个路径段,而不适用于其中的一部分。
有没有办法将各个桶的所有存储规则都放在一个文件中?
| 归档时间: |
|
| 查看次数: |
161 次 |
| 最近记录: |