package
0.0.0-20240814010835-9fc48a241e25
Repository: https://github.com/surahman/ftex.git
Documentation: pkg.go.dev

# README

HTTP GraphQL API

Configuration loading is designed for containerization in mind. The container engine and orchestrator can mount volumes (secret or regular) as well as set the environment variables as outlined below.

You may set configurations through both files and environment variables. Please note that environment variables will override the settings in the configuration files. The configuration files are all expected to be in YAML format.


Table of contents


File Location(s)

The configuration loader will search for the configurations in the following order:

LocationDetails
/etc/FTeX.conf/The etc directory is the canonical location for configurations.
$HOME/.FTeX/Configurations can be located in the user's home directory.
./configs/The config folder in the root directory where the application is located.
Environment variablesFinally, the configurations will be loaded from environment variables and override configuration files

Configuration File

The expected file name is HTTPGraphQLConfig.yaml. All the configuration items below are required.

NameEnvironment Variable KeyTypeDescription
ServerREST_SERVERParent key for server configurations.
↳ portNumber.PORTNUMBERintService port for inbound and outbound connections.
↳ basePath.BASEPATHstringThe service endpoints base path.
↳ playgroundPath.PLAYGROUNDPATHstringThe path through which the Playground UI will be accessible.
↳ queryPath.QUERYPATHstringThe path through which queries can be submitted.
↳ shutdownDelay.SHUTDOWNDELAYtime.DurationThe number of seconds to wait after a shutdown signal is received to terminate the server.
↳ readTimeout.READTIMEOUTtime.DurationThe maximum duration to read an entire request with the body before timing out.
↳ writeTimeout.WRITETIMEOUTtime.DurationThe maximum duration to write entire response before timing out.
↳ ReadHeaderTimeout.READHEADERTIMEOUTtime.DurationThe maximum duration to read an entire request header before timing out.
AuthorizationREST_AUTHORIZATIONParent key for authentication configurations.
↳ headerKey.HEADERKEYstringThe HTTP header key where the authorization token is stored.

Example Configuration File

server:
  portNumber: 47130
  basePath: api/graphql/v1
  playgroundPath: /playground
  queryPath: /query
  shutdownDelay: 5s
  readTimeout: 3s
  writeTimeout: 3s
  readHeaderTimeout: 3s
authorization:
  headerKey: Authorization

Example Environment Variables

export GRAPHQL_SERVER.PORTNUMBER=47130
export GRAPHQL_SERVER.BASEPATH=api/graphql/v1

Playground UI

The Playground UI is accessible through the endpoint URL that is provided in the configurations to view the GraphQL schemas as well as issue test requests to the endpoints.

# Packages

No description provided by the author
No description provided by the author

# Functions

NewServer will create a new GraphQL server instance in a non-running state.

# Structs

Server is the HTTP GraphQL server.