Skip to content

Support common http_content config option#205

Open
elliterate wants to merge 1 commit into
vatesfr:mainfrom
elliterate:http-content
Open

Support common http_content config option#205
elliterate wants to merge 1 commit into
vatesfr:mainfrom
elliterate:http-content

Conversation

@elliterate
Copy link
Copy Markdown

The packer-plugin-sdk supports an http_content config option that allows one to specify the served file contents inline rather than specify a directory on the local filesystem. This allows one to easily use HCL expressions and functions, such as templatefile, to dynamically generate the served files.

Addresses #49 and #180.

Comment on lines +52 to +58
func (s *StepHTTPServer) Handler(config *CommonConfig) http.Handler {
if config.HTTPDir != "" {
return http.FileServer(http.Dir(config.HTTPDir))
}

return commonsteps.MapServer(config.HTTPContent)
}
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this type largely appears to be a fork of packer-plugin-sdk's StepHTTPServer type, I opted to approximately mirror that package's Handler() function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant