-
-
Save dio/d4d89fd0d31f82322406ef6c6ce7c457 to your computer and use it in GitHub Desktop.
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
package envoy | |
import ( | |
"context" | |
"io" | |
"os/exec" | |
) | |
type Options struct{} | |
type Runtime struct { | |
ctx context.Context | |
cancel context.CancelFunc | |
Out, Err io.Writer | |
} | |
func NewRuntime(opts Options) *Runtime { | |
ctx, cancel := context.WithCancel(context.Background()) | |
return &Runtime{ | |
ctx: ctx, | |
cancel: cancel, | |
} | |
} | |
func (r *Runtime) Name() string { | |
return "envoy" | |
} | |
// Serve starts the server. | |
func (r *Runtime) Serve() error { | |
return exec.CommandContext(r.ctx, "/home/dio/.func-e/versions/1.20.0/bin/envoy", "-c", "/home/dio/tetrate/bff/bff/internal/envoy/config.yaml").Run() | |
} | |
// GracefulStop stops the server gracefully. | |
func (r *Runtime) GracefulStop() { | |
r.cancel() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment