This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"tunnels": [ | |
{ | |
"name": "command_line", | |
"uri": "/api/tunnels/command_line", | |
"public_url": "https://b42658ec.ngrok.io", | |
"proto": "https", | |
"config": { | |
"addr": "http://nginx-service:80", | |
"inspect": true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM fnproject/go:dev as build-stage | |
WORKDIR /function | |
RUN go get -u github.com/golang/dep/cmd/dep | |
ADD . /go/src/func/ | |
RUN cd /go/src/func/ && dep ensure | |
RUN cd /go/src/func/ && go build -o func | |
FROM fnproject/go | |
WORKDIR /function | |
COPY --from=build-stage /go/src/func/func /function/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.... | |
var updateInfo UpdateInfo | |
json.NewDecoder(in).Decode(&updateInfo) | |
_, err := cc.UpdateInstance(context.Background(), core.UpdateInstanceRequest{InstanceId: common.String(updateInfo.OCID), UpdateInstanceDetails: core.UpdateInstanceDetails{DisplayName: common.String(updateInfo.NewDisplayName)}}) | |
.... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.... | |
var criteria SearchCriteria | |
json.NewDecoder(in).Decode(&criteria) | |
cmpt := criteria.CompartmentIDFilter | |
instances := []Instance{} | |
resp, err := cc.ListInstances(context.Background(), core.ListInstancesRequest{CompartmentId: common.String(cmpt)}) | |
for _, instance := range resp.Items { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.... | |
tenancy := os.Getenv("TENANT_OCID") | |
user := os.Getenv("USER_OCID") | |
region := os.Getenv("REGION") | |
fingerprint := os.Getenv("FINGERPRINT") | |
privateKeyName := os.Getenv("OCI_PRIVATE_KEY_FILE_NAME") | |
privateKeyLocation := privateKeyFolder + "/" + privateKeyName | |
passphrase := os.Getenv("PASSPHRASE") | |
privateKey, err := ioutil.ReadFile(privateKeyLocation) | |
.... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM fnproject/go:dev as build-stage | |
WORKDIR /function | |
RUN go get -u github.com/golang/dep/cmd/dep | |
ADD . /go/src/func/ | |
RUN cd /go/src/func/ && dep ensure | |
RUN cd /go/src/func/ && go build -o func | |
FROM fnproject/go | |
RUN apk add --no-cache flite | |
WORKDIR /function |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
speech, err := ioutil.ReadFile(outputLocation) | |
if err != nil { | |
errMsg := "could not read from .wav file " + err.Error() | |
log.Println(errMsg) | |
out.Write([]byte(errMsg)) | |
return | |
} | |
log.Println("Returning .wav bytes") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defer func() { | |
fileErr := os.Remove(outputLocation) | |
if fileErr == nil { | |
log.Println("Deleted temp file", outputLocation) | |
} else { | |
log.Println("Error removing output file", fileErr.Error()) | |
} | |
}() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
flite := exec.Command("flite", "-t", text, "-o", outputLocation) | |
err := flite.Run() | |
if err != nil { | |
errMsg := "failed due to " + err.Error() | |
log.Println(errMsg) | |
out.Write([]byte(errMsg)) | |
return | |
} | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func main() { | |
fdk.Handle(fdk.HandlerFunc(text2speech)) | |
} | |
func text2speech(ctx context.Context, in io.Reader, out io.Writer) { | |
buf := new(bytes.Buffer) | |
buf.ReadFrom(in) | |
text := buf.String() | |
.... |