Skip to content

Commit 49b5d9b

Browse files
authored
Merge pull request #6 from lbernardo/develop
Fix enviroment
2 parents 4d5f926 + 31b4ce0 commit 49b5d9b

File tree

5 files changed

+14
-10
lines changed

5 files changed

+14
-10
lines changed

bin/darwin/lambda-local

0 Bytes
Binary file not shown.

bin/linux/lambda-local

0 Bytes
Binary file not shown.

controller/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,14 @@ func (se *Server) ContentYaml() {
7878

7979
func (se *Server) StartConfig() {
8080
se.ContentYaml()
81-
lambda.PullImageDocker(se.JSON.Provider["runtime"])
81+
lambda.PullImageDocker(se.JSON.Provider.Runtime)
8282

8383
http.Handle("/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
8484
se.ContentYaml()
8585
for _, functions := range se.JSON.Functions {
8686
check, parameters := checkPath(functions.Events[0].HttpEvent, r.URL.RequestURI(), r.Method)
8787
if check {
88-
result, off := lambda.ExecuteDockerLambda(se.Volume, se.Network, functions.Handler, se.JSON.Provider["runtime"], se.JSON.Environment, r.Body, parameters)
88+
result, off := lambda.ExecuteDockerLambda(se.Volume, se.Network, functions.Handler, se.JSON.Provider.Runtime, se.JSON.Provider.Environment, r.Body, parameters)
8989
if result.StatusCode == 0 {
9090
w.WriteHeader(400)
9191
fmt.Println(off)

example/go/serverless.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ service: myservice
33
provider:
44
name: aws
55
runtime: go1.x
6-
7-
environment:
8-
DATABASE: "mydatabase"
9-
TABLE_NAME: table-${opt:stage, self:provider.stage}
6+
environment:
7+
DATABASE: "mydatabase"
8+
TABLE_NAME: table-${opt:stage, self:provider.stage}
109

1110
functions:
1211
hello:
@@ -20,4 +19,4 @@ functions:
2019
events:
2120
- http:
2221
path: world
23-
method: get
22+
method: get

model/serverless.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
package model
22

33
type Serverless struct {
4-
Functions map[string]Functions `json:"functions"`
5-
Provider map[string]string `json:"provider"`
6-
Environment map[string]string `json:"environment"`
4+
Functions map[string]Functions `json:"functions"`
5+
Provider Provider `json:"provider"`
76
}
87

98
type Functions struct {
@@ -19,3 +18,9 @@ type HttpEvent struct {
1918
Method string `json:"method"`
2019
Path string `json:"path"`
2120
}
21+
22+
type Provider struct {
23+
Environment map[string]string `json:"environment"`
24+
Name string `json:"name"`
25+
Runtime string `json:"runtime"`
26+
}

0 commit comments

Comments
 (0)