Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/localstack/awsutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ func resetListener(changeChannel <-chan bool, server *CustomInteropServer) {

}

func RunHotReloadingListener(server *CustomInteropServer, targetPaths []string, opts *LsOpts, ctx context.Context) {
if !opts.HotReloading {
func RunHotReloadingListener(server *CustomInteropServer, targetPaths []string, ctx context.Context) {
if len(targetPaths) == 1 && targetPaths[0] == "" {
log.Debugln("Hot reloading disabled.")
return
}
Expand Down
19 changes: 10 additions & 9 deletions cmd/localstack/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,16 @@ import (
"os"
"runtime/debug"
"strconv"
"strings"
)

type LsOpts struct {
InteropPort string
RuntimeEndpoint string
RuntimeId string
InitTracingPort string
CodeDownloadUrl string
HotReloading bool
InteropPort string
RuntimeEndpoint string
RuntimeId string
InitTracingPort string
CodeDownloadUrl string
HotReloadingPaths []string
}

func GetEnvOrDie(env string) string {
Expand All @@ -38,8 +39,8 @@ func InitLsOpts() *LsOpts {
InteropPort: GetenvWithDefault("LOCALSTACK_INTEROP_PORT", "9563"),
InitTracingPort: GetenvWithDefault("LOCALSTACK_RUNTIME_TRACING_PORT", "9564"),
// optional or empty
CodeDownloadUrl: os.Getenv("LOCALSTACK_CODE_ARCHIVE_DOWNLOAD_URL"),
HotReloading: os.Getenv("LOCALSTACK_HOT_RELOADING_ENABLED") != "",
CodeDownloadUrl: os.Getenv("LOCALSTACK_CODE_ARCHIVE_DOWNLOAD_URL"),
HotReloadingPaths: strings.Split(GetenvWithDefault("LOCALSTACK_HOT_RELOADING_PATHS", ""), ","),
}
}

Expand Down Expand Up @@ -88,7 +89,7 @@ func main() {
if err != nil {
log.Fatalln(err)
}
go RunHotReloadingListener(interopServer, []string{"/var/task"}, lsOpts, fileWatcherContext)
go RunHotReloadingListener(interopServer, lsOpts.HotReloadingPaths, fileWatcherContext)

// start runtime init
go InitHandler(sandbox, GetEnvOrDie("AWS_LAMBDA_FUNCTION_VERSION"), int64(invokeTimeoutSeconds)) // TODO: replace this with a custom init
Expand Down