-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
127 lines (103 loc) · 2.29 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
package main
import (
"embed"
"io/fs"
"log"
"net/http"
_ "embed"
"github.com/gorchestrate/async"
"github.com/gorchestrate/gasync"
)
/*
Workflows
- Order
- order1
- order2
- order3
- Delivery
- Pizza
ACL:
Workflows: a,b,c
A:
View:
[{
Query - which workflows we can see
{
equal: {
key:"",
value:""
},
not-equal: {
key:"",
value:""
},
contains: {
key: "",
value: ""
},
range:
key:
ge:
le:
lte:
gte:
}
Expr Match
PrefixFilter - what parts of workflows we can see
{
"include": *
"exclude": *.secrets
"events": * - what events are allowed
}
}]
Filter-based access levels:
- ReadQuery -> allow to see workflows matching query (added on query level)
- ReadSubquery -> allow to see parts of workflows mathing query (filtered after query)
- New -> allow to create new workflow
- Delete -> allow to delete workflow
- Event -> allow to delete workflow
- Change -> allow to update parts of the workflow matching query
Problem: how to make this filtering logic unified across databases?
[
"query": {
filter: "Firestore-compatible filter",
},
"include": ...,
"exclude": ...,
]
Using this logic - Frontend can query whatever they want from backend.
??? query language ???
*/
// ReadFilter ->
// -
// F
// RW roles => operation: Read, Event
//go:embed ui/build/*
var ui embed.FS
var gs *gasync.Server
func main() {
var err error
gs, err = gasync.NewServer(gasync.Config{
GCloudProjectID: "async-315408",
GCloudLocationID: "us-central1",
GCloudTasksQueueName: "order",
BasePublicURL: "https://pizzaapp-ffs2ro4uxq-uc.a.run.app",
CORS: true,
Collection: "workflows",
SignSecret: "{Secret to sign callbacks sent over public API from Google Cloud Tasks}",
}, map[string]func() async.WorkflowState{
"pizza": func() async.WorkflowState {
return &PizzaOrderWorkflow{}
},
})
if err != nil {
log.Fatal(err)
}
log.Print("AAAA")
sub, err := fs.Sub(ui, "ui/build")
if err != nil {
log.Fatal(err)
}
gs.Router.PathPrefix("/ui/").Handler(http.StripPrefix("/ui/", http.FileServer(http.FS(sub))))
log.Fatal(http.ListenAndServe(":8080", gs.Router))
}