app

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

  • ReGraphQL - Proxy
  • This is the proxy service of project ReGraphQL *
  • Contact: ezequiel.aceto+regraphql@gmail.com

Package app is in charge of loading application Configuration, and providing (app) global constants

Index

Constants

View Source
const (
	EnvironmentVariablesFile = ".env"

	ServerHostKey          = "SERVER_HOST"
	ServerHostDefaultValue = ""

	ServerPortKey          = "SERVER_PORT"
	ServerPortDefaultValue = 8080

	ServicePathKey          = "SERVICE_PATH"
	ServicePathDefaultValue = "/graphql"

	ServerReadTimeoutKey      = "SERVER_READ_TIMEOUT"
	ServerWriteTimeoutKey     = "SERVER_WRITE_TIMEOUT"
	ServerTimeoutDefaultValue = "120"

	RouterConfigPathKey          = "ROUTER_CONFIG_PATH"
	RouterConfigPathDefaultValue = "/data/config/"

	TraceCallsKey          = "TRACE_CALLS"
	TraceCallsDefaultValue = "0"

	DebugKey          = "DEBUG"
	DebugDefaultValue = "0"

	PreAllocatedRoutesNumber = 10

	HealthPath  = "/health"
	MetricsPath = "/metrics"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application struct {
	Router        *mux.Router
	Routes        []Route
	Configuration *Configuration
}

func NewApplication

func NewApplication(rootRouter *mux.Router) (*Application, error)

type Configuration

type Configuration struct {
	ServerAddr         string
	ServicePath        string
	ServerReadTimeout  time.Duration
	ServerWriteTimeout time.Duration
	RouterConfigsPath  string
	TraceCallsEnabled  bool
	DebugEnabled       bool
	HTTPClient         *http.Client
}

func NewConfiguration

func NewConfiguration() (*Configuration, error)

type Route

type Route struct {
	HTTP struct {
		URI    string `yaml:"uri"`
		Method string `yaml:"method"`
	} `yaml:"http"`
	GraphQL struct {
		Endpoint string            `yaml:"endpoint"`
		Query    string            `yaml:"query"`
		Types    map[string]string `yaml:"types"`
	} `yaml:"graphql"`
}

Jump to

Keyboard shortcuts

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