oto/services/core/internal/httpserver/bootstrap_provider.go
toki ac44c85d34 feat: Windows bootstrap script and HTTP server updates
- Add PowerShell bootstrap script for Windows runner
- Update httpserver bootstrap provider, routes, and runner handlers
- Add bootstrap PowerShell test case
- Move old G07 task docs to archive
- Update server tests
2026-06-15 22:10:21 +09:00

42 lines
1.2 KiB
Go

package httpserver
import (
_ "embed"
"fmt"
)
//go:embed oto_agent_bootstrap.sh
var embeddedBootstrapScript []byte
//go:embed oto_agent_bootstrap.ps1
var embeddedBootstrapPs1 []byte
// bootstrapScriptProvider returns the content of the OTO agent bootstrap script.
type bootstrapScriptProvider interface {
bootstrapScript() ([]byte, error)
}
// bootstrapPs1Provider returns the content of the OTO agent PowerShell bootstrap script.
type bootstrapPs1Provider interface {
bootstrapPs1() ([]byte, error)
}
// embeddedBootstrapProvider serves the shell 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
}
// embeddedBootstrapPs1Provider serves the PowerShell script compiled into the binary via go:embed.
type embeddedBootstrapPs1Provider struct{}
func (embeddedBootstrapPs1Provider) bootstrapPs1() ([]byte, error) {
if len(embeddedBootstrapPs1) == 0 {
return nil, fmt.Errorf("embedded bootstrap PS1 script is empty")
}
return embeddedBootstrapPs1, nil
}