-
Notifications
You must be signed in to change notification settings - Fork 238
/
Copy pathconstants.go
75 lines (68 loc) · 1.82 KB
/
constants.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
package config
import (
_ "embed"
"regexp"
"github.com/go-errors/errors"
"github.com/mitchellh/mapstructure"
)
const (
pg13 = "supabase/postgres:13.3.0"
pg14 = "supabase/postgres:14.1.0.89"
deno2 = "supabase/edge-runtime:v1.68.0-develop.8"
)
type images struct {
Pg15 string `mapstructure:"pg15"`
// Append to Services when adding new dependencies below
Kong string `mapstructure:"kong"`
Inbucket string `mapstructure:"mailpit"`
Postgrest string `mapstructure:"postgrest"`
Pgmeta string `mapstructure:"pgmeta"`
Studio string `mapstructure:"studio"`
ImgProxy string `mapstructure:"imgproxy"`
EdgeRuntime string `mapstructure:"edgeruntime"`
Vector string `mapstructure:"vector"`
Supavisor string `mapstructure:"supavisor"`
Gotrue string `mapstructure:"gotrue"`
Realtime string `mapstructure:"realtime"`
Storage string `mapstructure:"storage"`
Logflare string `mapstructure:"logflare"`
// Append to Jobs when adding new dependencies below
Differ string `mapstructure:"differ"`
Migra string `mapstructure:"migra"`
PgProve string `mapstructure:"pgprove"`
}
var (
//go:embed templates/Dockerfile
dockerImage string
imagePattern = regexp.MustCompile(`(?i)FROM\s+([^\s]+)\s+AS\s+([^\s]+)`)
Images images
)
func init() {
matches := imagePattern.FindAllStringSubmatch(dockerImage, -1)
result := make(map[string]string, len(matches))
for _, m := range matches {
if len(m) == 3 {
result[m[2]] = m[1]
}
}
if err := mapstructure.Decode(result, &Images); err != nil {
panic(errors.Errorf("failed to decode images: %w", err))
}
}
func (s images) Services() []string {
return []string{
s.Gotrue,
s.Realtime,
s.Storage,
s.ImgProxy,
s.Kong,
s.Inbucket,
s.Postgrest,
s.Pgmeta,
s.Studio,
s.EdgeRuntime,
s.Logflare,
s.Vector,
s.Supavisor,
}
}