/
applications.go
55 lines (49 loc) · 1.19 KB
/
applications.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
package compile
import (
"github.com/taubyte/config-compiler/indexer"
)
func (c *compiler) application(name string) (appID string, appObject map[string]interface{}, err error) {
app, err := c.config.Project.Application(name)
if err != nil {
return
}
getter := app.Get()
appID = getter.Id()
if len(appID) == 0 {
return "", nil, nil
}
appObject = map[string]interface{}{
"name": getter.Name(),
"description": getter.Description(),
}
_tags := getter.Tags()
if len(_tags) > 0 {
appObject["tags"] = _tags
}
ctx := &indexer.IndexContext{
AppId: appID,
AppName: name,
Branch: c.ctx.Branch,
ProjectId: c.ctx.ProjectId,
Commit: c.ctx.Commit,
Obj: appObject,
Dev: c.dev,
GeneratedDomainRegExp: c.config.GeneratedDomainRegExp,
}
for _type, iFace := range compilationGroup(c.config.Project) {
local, _ := iFace.Get(name)
if len(local) > 0 {
appObject[_type], err = c.magic(local, name, iFace.Compile)
if err != nil {
return
}
if iFace.Indexer != nil {
err = c.indexer(ctx, iFace.Indexer)
if err != nil {
return
}
}
}
}
return
}