Support importing into the cli

This commit is contained in:
Owen
2026-09-15 11:08:47 -04:00
parent acb014e23e
commit 9e29d0b4ff
5 changed files with 146 additions and 98 deletions
+9 -5
View File
@@ -16,6 +16,7 @@ import (
"github.com/fosrl/newt/internal/telemetry"
"github.com/fosrl/newt/logger"
newtpkg "github.com/fosrl/newt/newt"
"github.com/fosrl/newt/newtconfig"
"github.com/fosrl/newt/updates"
"github.com/fosrl/newt/websocket"
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
@@ -62,7 +63,14 @@ func main() {
func runNewtMain(ctx context.Context) {
logger.Init(nil)
cfg := loadNewtConfig()
cfg, err := newtconfig.Load(newtconfig.Options{
Args: os.Args[1:],
Version: newtVersion,
Platform: newtPlatform,
})
if err != nil {
logger.Fatal("Configuration error: %v", err)
}
if cfg.UseNativeMainInterface {
if err := permissions.CheckNativeInterfacePermissions(); err != nil {
@@ -70,10 +78,6 @@ func runNewtMain(ctx context.Context) {
}
}
if err := validateTLSConfig(cfg); err != nil {
logger.Fatal("TLS configuration error: %v", err)
}
logger.Debug("Endpoint: %v", cfg.Endpoint)
logger.Debug("Log Level: %v", cfg.LogLevel)
logger.Debug("Docker Network Validation Enabled: %v", cfg.DockerEnforceNetworkValidation)