-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
49 lines (43 loc) · 1.76 KB
/
Copy pathmain.go
File metadata and controls
49 lines (43 loc) · 1.76 KB
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
// Binary service-python is the generic Python agent entry point.
//
// All logic lives in subpackages under ./pkg so specializations
// (python-fastapi, python-grpc, …) can import and compose them:
//
// github.com/codefly-dev/service-python/pkg/service — shared Service/Settings
// github.com/codefly-dev/service-python/pkg/runtime — Runtime gRPC server
// github.com/codefly-dev/service-python/pkg/code — Code gRPC server
// github.com/codefly-dev/service-python/pkg/tooling — Tooling gRPC server
// github.com/codefly-dev/service-python/pkg/builder — Builder gRPC server
//
// A specialization's main.go embeds these types (via Go struct embedding)
// and overrides only what its layer adds.
package main
import (
"embed"
"github.com/codefly-dev/core/agents"
"github.com/codefly-dev/core/resources"
"github.com/codefly-dev/core/shared"
"github.com/codefly-dev/core/toolbox/lang"
pythonbuilder "github.com/codefly-dev/service-python/pkg/builder"
pythoncode "github.com/codefly-dev/service-python/pkg/code"
pythonruntime "github.com/codefly-dev/service-python/pkg/runtime"
pythonservice "github.com/codefly-dev/service-python/pkg/service"
pythontooling "github.com/codefly-dev/service-python/pkg/tooling"
)
//go:embed agent.codefly.yaml
var infoFS embed.FS
var agent = shared.Must(resources.LoadFromFs[resources.Agent](shared.Embed(infoFS)))
func main() {
svc := pythonservice.New(agent.Of(resources.ServiceAgent))
code := pythoncode.New(svc)
runtime := pythonruntime.New(svc)
tooling := pythontooling.New(code, runtime)
agents.Serve(agents.PluginRegistration{
Agent: svc,
Runtime: runtime,
Builder: pythonbuilder.New(svc),
Code: code,
Tooling: tooling,
Toolbox: lang.NewToolboxFromTooling(agent.Name, agent.Version, tooling),
})
}