mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-12 11:15:12 +00:00
Add runtime option to function API (#228)
This commit is contained in:
@@ -126,10 +126,13 @@ func (e *Function) Deploy(ctx context.Context, req *function.DeployRequest, rsp
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if req.Runtime == "" {
|
||||
return fmt.Errorf("missing runtime field, please specify nodejs14, go116 etc")
|
||||
}
|
||||
|
||||
go func() {
|
||||
// https://jsoverson.medium.com/how-to-deploy-node-js-functions-to-google-cloud-8bba05e9c10a
|
||||
cmd := exec.Command("gcloud", "functions", "deploy", multitenantPrefix+"-"+req.Name, "--region", "europe-west1", "--allow-unauthenticated", "--entry-point", req.Entrypoint, "--trigger-http", "--project", e.project, "--runtime", "nodejs14")
|
||||
cmd := exec.Command("gcloud", "functions", "deploy", multitenantPrefix+"-"+req.Name, "--region", "europe-west1", "--allow-unauthenticated", "--entry-point", req.Entrypoint, "--trigger-http", "--project", e.project, "--runtime", req.Runtime)
|
||||
cmd.Dir = filepath.Join(gitter.RepoDir(), req.Subfolder)
|
||||
outp, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
@@ -147,6 +150,7 @@ func (e *Function) Deploy(ctx context.Context, req *function.DeployRequest, rsp
|
||||
"repo": req.Repo,
|
||||
"subfolder": req.Subfolder,
|
||||
"entrypoint": req.Entrypoint,
|
||||
"runtime": req.Runtime,
|
||||
})
|
||||
err = s.UnmarshalJSON(jso)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user