24 lines
622 B
Go
24 lines
622 B
Go
package httpserver
|
|
|
|
import (
|
|
_ "embed"
|
|
"fmt"
|
|
)
|
|
|
|
//go:embed oto_agent_bootstrap.sh
|
|
var embeddedBootstrapScript []byte
|
|
|
|
// bootstrapScriptProvider returns the content of the OTO agent bootstrap script.
|
|
type bootstrapScriptProvider interface {
|
|
bootstrapScript() ([]byte, error)
|
|
}
|
|
|
|
// embeddedBootstrapProvider serves the script compiled into the binary via go:embed.
|
|
type embeddedBootstrapProvider struct{}
|
|
|
|
func (embeddedBootstrapProvider) bootstrapScript() ([]byte, error) {
|
|
if len(embeddedBootstrapScript) == 0 {
|
|
return nil, fmt.Errorf("embedded bootstrap script is empty")
|
|
}
|
|
return embeddedBootstrapScript, nil
|
|
}
|