Beispiel #1
0
func main() {
	var eus []string
	if len(etcdUrls) > 0 {
		eus = strings.Split(etcdUrls, ",")
	}

	options := skipper.Options{
		Address:                   address,
		EtcdUrls:                  eus,
		EtcdPrefix:                etcdPrefix,
		InnkeeperUrl:              innkeeperUrl,
		SourcePollTimeout:         time.Duration(sourcePollTimeout) * time.Millisecond,
		RoutesFile:                routesFile,
		IgnoreTrailingSlash:       false,
		OAuthUrl:                  oauthUrl,
		OAuthScope:                oauthScope,
		OAuthCredentialsDir:       oauthCredentialsDir,
		InnkeeperAuthToken:        innkeeperAuthToken,
		InnkeeperPreRouteFilters:  innkeeperPreRouteFilters,
		InnkeeperPostRouteFilters: innkeeperPostRouteFilters,
		DevMode:                   devMode}
	if insecure {
		options.ProxyOptions |= proxy.OptionsInsecure
	}

	log.Fatal(skipper.Run(options))
}
Beispiel #2
0
func main() {
	cpuProfile := "cpu-profile.prof"
	if len(os.Args) > 1 {
		cpuProfile = os.Args[1]
	}

	memProfile := "mem-profile.prof"
	if len(os.Args) > 2 {
		memProfile = os.Args[2]
	}

	address := ":9090"
	if len(os.Args) > 3 {
		address = os.Args[3]
	}

	routesFile := "routes.eskip"
	if len(os.Args) > 4 {
		routesFile = os.Args[4]
	}

	cpuOut, err := os.Create(cpuProfile)
	if err != nil {
		log.Fatal(err)
	}

	memOut, err := os.Create(memProfile)
	if err != nil {
		log.Fatal(err)
	}

	pprof.StartCPUProfile(cpuOut)
	defer func() {
		pprof.StopCPUProfile()
		pprof.Lookup("heap").WriteTo(memOut, 0)
	}()

	sigint := make(chan os.Signal, 1)
	signal.Notify(sigint, os.Interrupt, syscall.SIGTERM)

	go func() {
		err = skipper.Run(skipper.Options{
			AccessLogDisabled: true,
			Address:           address,
			RoutesFile:        routesFile})
		if err != nil {
			log.Fatal(err)
		}
	}()

	<-sigint
}
Beispiel #3
0
func main() {
	var eus []string
	if len(etcdUrls) > 0 {
		eus = strings.Split(etcdUrls, ",")
	}

	options := skipper.Options{
		Address:                   address,
		EtcdUrls:                  eus,
		EtcdPrefix:                etcdPrefix,
		InnkeeperUrl:              innkeeperUrl,
		SourcePollTimeout:         time.Duration(sourcePollTimeout) * time.Millisecond,
		RoutesFile:                routesFile,
		IgnoreTrailingSlash:       false,
		OAuthUrl:                  oauthUrl,
		OAuthScope:                oauthScope,
		OAuthCredentialsDir:       oauthCredentialsDir,
		InnkeeperAuthToken:        innkeeperAuthToken,
		InnkeeperPreRouteFilters:  innkeeperPreRouteFilters,
		InnkeeperPostRouteFilters: innkeeperPostRouteFilters,
		DevMode:                   devMode,
		MetricsListener:           metricsListener,
		MetricsPrefix:             metricsPrefix,
		EnableDebugGcMetrics:      debugGcMetrics,
		EnableRuntimeMetrics:      runtimeMetrics,
		ApplicationLogOutput:      applicationLog,
		ApplicationLogPrefix:      applicationLogPrefix,
		AccessLogOutput:           accessLog,
		AccessLogDisabled:         accessLogDisabled}

	if insecure {
		options.ProxyOptions |= proxy.OptionsInsecure
	}

	if proxyPreserveHost {
		options.ProxyOptions |= proxy.OptionsProxyPreserveHost
	}

	log.Fatal(skipper.Run(options))
}
Beispiel #4
0
func main() {
	if logLevel, err := log.ParseLevel(applicationLogLevel); err != nil {
		log.Fatal(err)
	} else {
		log.SetLevel(logLevel)
	}

	var eus []string
	if len(etcdUrls) > 0 {
		eus = strings.Split(etcdUrls, ",")
	}

	clsic, err := parseDurationFlag(closeIdleConnsPeriod)
	if err != nil {
		flag.PrintDefaults()
		os.Exit(2)
	}

	options := skipper.Options{
		Address:                   address,
		EtcdUrls:                  eus,
		EtcdPrefix:                etcdPrefix,
		KubernetesURL:             kubernetesURL,
		KubernetesHealthcheck:     kubernetesHealthcheck,
		InnkeeperUrl:              innkeeperUrl,
		SourcePollTimeout:         time.Duration(sourcePollTimeout) * time.Millisecond,
		RoutesFile:                routesFile,
		IdleConnectionsPerHost:    idleConnsPerHost,
		CloseIdleConnsPeriod:      time.Duration(clsic) * time.Second,
		IgnoreTrailingSlash:       false,
		OAuthUrl:                  oauthUrl,
		OAuthScope:                oauthScope,
		OAuthCredentialsDir:       oauthCredentialsDir,
		InnkeeperAuthToken:        innkeeperAuthToken,
		InnkeeperPreRouteFilters:  innkeeperPreRouteFilters,
		InnkeeperPostRouteFilters: innkeeperPostRouteFilters,
		DevMode:                   devMode,
		MetricsListener:           metricsListener,
		MetricsPrefix:             metricsPrefix,
		EnableDebugGcMetrics:      debugGcMetrics,
		EnableRuntimeMetrics:      runtimeMetrics,
		EnableServeRouteMetrics:   serveRouteMetrics,
		EnableServeHostMetrics:    serveHostMetrics,
		ApplicationLogOutput:      applicationLog,
		ApplicationLogPrefix:      applicationLogPrefix,
		AccessLogOutput:           accessLog,
		AccessLogDisabled:         accessLogDisabled,
		DebugListener:             debugListener,
		CertPathTLS:               certPathTLS,
		KeyPathTLS:                keyPathTLS,
		BackendFlushInterval:      backendFlushInterval,
		ExperimentalUpgrade:       experimentalUpgrade,
	}

	if insecure {
		options.ProxyFlags |= proxy.Insecure
	}

	if proxyPreserveHost {
		options.ProxyFlags |= proxy.PreserveHost
	}

	log.Fatal(skipper.Run(options))
}