func New(config *Config) (*Sat, error) {
	wruntime.UseInternalLogger(config.Logger)

	exec := executor.NewWithGrav(config.Logger, nil)

	var runner rt.Runnable
	if config.Runnable != nil && len(config.Runnable.ModuleRef.Data) > 0 {
		runner = rwasm.NewRunnerWithRef(config.Runnable.ModuleRef)
	} else {
		runner = rwasm.NewRunner(config.RunnableArg)
	}

	exec.Register(
		config.JobType,
		runner,
		&config.CapConfig,
		rt.Autoscale(24),
		rt.MaxRetries(0),
		rt.RetrySeconds(0),
		rt.PreWarm(),
	)

	sat := &Sat{
		c: config,
		j: config.JobType,
		e: exec,
		t: websocket.New(),
		l: config.Logger,
	}

	// no need to continue setup if we're in stdin mode, so return here
	if config.UseStdin {
		return sat, nil
	}

	// Grav and Vektor will be started on call to s.Start()

	sat.v = vk.New(
		vk.UseLogger(config.Logger),
		vk.UseAppName(config.PrettyName),
		vk.UseHTTPPort(config.Port),
		vk.UseEnvPrefix("SAT"),
		vk.UseQuietRoutes("/meta/metrics"),
	)

	sat.v.HandleHTTP(http.MethodGet, "/meta/message", sat.t.HTTPHandlerFunc())
	sat.v.GET("/meta/metrics", sat.metricsHandler())
	sat.v.POST("/*any", sat.handler(exec))

	return sat, nil
}
// New initializes Reactr, Vektor, and Grav in a Sat instance
// if config.UseStdin is true, only Reactr will be created
New initializes Reactr, Vektor, and Grav in a Sat instance
if config.UseStdin is true, only Reactr will be created
// New initializes Reactr Vektor and Grav in a Sat instance // if config . UseStdin is true only Reactr will be created
func New(config *Config) (*Sat, error) {
	wruntime.UseInternalLogger(config.Logger)
	exec := executor.NewWithGrav(config.Logger, nil)
	var runner rt.Runnable
	if config.Runnable != nil && len(config.Runnable.ModuleRef.Data) > 0 {
		runner = rwasm.NewRunnerWithRef(config.Runnable.ModuleRef)
	} else {
		runner = rwasm.NewRunner(config.RunnableArg)
	}
	exec.Register(
		config.JobType,
		runner,
		&config.CapConfig,
		rt.Autoscale(24),
		rt.MaxRetries(0),
		rt.RetrySeconds(0),
		rt.PreWarm(),
	)
	sat := &Sat{
		c: config,
		j: config.JobType,
		e: exec,
		t: websocket.New(),
		l: config.Logger,
	}
	if config.UseStdin {
		return sat, nil
	}
	sat.v = vk.New(
		vk.UseLogger(config.Logger),
		vk.UseAppName(config.PrettyName),
		vk.UseHTTPPort(config.Port),
		vk.UseEnvPrefix("SAT"),
		vk.UseQuietRoutes("/meta/metrics"),
	)
	sat.v.HandleHTTP(http.MethodGet, "/meta/message", sat.t.HTTPHandlerFunc())
	sat.v.GET("/meta/metrics", sat.metricsHandler())
	sat.v.POST("/*any", sat.handler(exec))
	return sat, nil
}
func New ( config * Config ) ( * Sat , error ) { wruntime . UseInternalLogger ( config . Logger ) exec := executor . NewWithGrav ( config . Logger , nil ) var runner rt . Runnable if config . Runnable != nil && len ( config . Runnable . ModuleRef . Data ) > 0 { runner = rwasm . NewRunnerWithRef ( config . Runnable . ModuleRef ) } else { runner = rwasm . NewRunner ( config . RunnableArg ) } exec . Register ( config . JobType , runner , & config . CapConfig , rt . Autoscale ( 24 ) , rt . MaxRetries ( 0 ) , rt . RetrySeconds ( 0 ) , rt . PreWarm ( ) , ) sat := & Sat { c : config , j : config . JobType , e : exec , t : websocket . New ( ) , l : config . Logger , } if config . UseStdin { return sat , nil } sat . v = vk . New ( vk . UseLogger ( config . Logger ) , vk . UseAppName ( config . PrettyName ) , vk . UseHTTPPort ( config . Port ) , vk . UseEnvPrefix ( " " ) , vk . UseQuietRoutes ( " " ) , ) sat . v . HandleHTTP ( http . MethodGet , " " , sat . t . HTTPHandlerFunc ( ) ) sat . v . GET ( " " , sat . metricsHandler ( ) ) sat . v . POST ( " " , sat . handler ( exec ) ) return sat , nil }
New initializes Reactr, Vektor, and Grav in a Sat instance
if config.UseStdin is true, only Reactr will be created
New initializes Reactr Vektor and Grav in a Sat instance if config . UseStdin is true only Reactr will be created
// no need to continue setup if we're in stdin mode, so return here // Grav and Vektor will be started on call to s.Start()