bridge

package module
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2022 License: BSD-3-Clause Imports: 9 Imported by: 0

README

Bridge

.github/workflows/test.yml Go Reference

Bridge is a secure gateway that relays access from BaseMachina to a tenant's data sources. (Database, API, etc...)

Download

Q&A

Please post any questions about the bridge or the hosted service on the discussions.

Bugs

Please file any issues about this code or the hosted service on the issue tracker.

Contributing

PRs welcome! But please file bugs. Commit messages should reference bugs.

We require Developer Certificate of Origin Signed-off-by lines in commits.

About Us

BaseMachina is primarily developed by the people at https://github.com/orgs/basemachina/people.

Documentation

Index

Constants

View Source
const (
	OKPath    = "/ok"
	OKMessage = "bridge is ready"
	ProxyPath = "/htproxy"
)
View Source
const ConnectionCheckPort = "4321"

ConnectionCheckPort is used in connection check from API.

Variables

This section is empty.

Functions

func NewHTTPHandler

func NewHTTPHandler(c *HTTPHandlerConfig) http.Handler

NewHTTPHandler is a handler for handling any requests.

func NewHTTPServer added in v1.0.5

func NewHTTPServer(envPort string, handler http.Handler) (*http.Server, func(), error)

func ServeCheckConnectionServer added in v1.0.5

func ServeCheckConnectionServer()

ServeCheckConnectionServer serves http server that is used in connection check from API.

This server is no required to handle graceful because used only the connection check from API.

Serve with goroutine.

Types

type Env

type Env struct {
	// Port is port to listen HTTP server. Default is 8080.
	// This value should be other than 4321. because "127.0.0.1:4321" is used in connection checking.
	Port string `` /* 154-byte string literal not displayed */

	// LogLevel is INFO or DEBUG. Default is "INFO".
	LogLevel string `envconfig:"LOG_LEVEL" default:"INFO"`

	// APIURL is an url of basemachina.
	APIURL string `envconfig:"BASEMACHINA_API_URL" default:"https://api.basemachina.com"`

	// FetchInterval is interval to fetch
	FetchInterval time.Duration `envconfig:"FETCH_INTERVAL" default:"1h" description:"認可処理に利用する公開鍵を更新する間隔です。"`

	// FetchTimeout is timeout to fetch
	FetchTimeout time.Duration `` /* 132-byte string literal not displayed */

	// TenantID is ID of tenant
	TenantID string `` /* 180-byte string literal not displayed */
}

Env stores configuration settings extract from enviromental variables The practice getting from environmental variables comes from https://12factor.net.

type HTTPHandlerConfig

type HTTPHandlerConfig struct {
	Logger             logr.Logger
	PublicKeyGetter    auth.PublicKeyGetter
	RegisterUserObject auth.TenantIDGetter
	TenantID           string
	Middlewares        []bridgehttp.Middleware
}

HTTPHandlerConfig is a config to setup bridge http handler.

Directories

Path Synopsis
cmd
internal

Jump to

Keyboard shortcuts

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