static

package
Version: v1.5.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2019 License: Apache-2.0 Imports: 5 Imported by: 20

README

Static selector

The Static selector returns the named service as a node for every request. This is useful where you want to offload discovery and balancing to DNS (particularly useful with KubeDNS).

This DOES however require a static port assignment (because we no longer have the ability to look up metadata). This defaults to port 8080, but can be overriddden at runtime using env-vars.

An optional domain-name can be appended too.

Environment variables

  • "STATIC_SELECTOR_DOMAIN_NAME": An optional domain-name to append to the speicified service name.
  • "STATIC_SELECTOR_PORT_NUMBER": Override the default port (8080) for "discovered" services.

Usage

selector := static.NewSelector()

service := micro.NewService(
	client.NewClient(client.Selector(selector))
)

Documentation

Overview

Package static is a selector which always returns the name specified with a port-number appended. AN optional domain-name will also be added.

Index

Constants

View Source
const (
	ENV_STATIC_SELECTOR_DOMAIN_NAME = "STATIC_SELECTOR_DOMAIN_NAME"
	ENV_STATIC_SELECTOR_PORT_NUMBER = "STATIC_SELECTOR_PORT_NUMBER"
	DEFAULT_PORT_NUMBER             = "8080"
)

Variables

This section is empty.

Functions

func NewSelector

func NewSelector(opts ...selector.Option) selector.Selector

Types

This section is empty.

Source Files

Directories

Path Synopsis
module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL