References

GoFr Configuration Options

This document lists all the configuration options supported by the GoFr framework. The configurations are grouped by category for better organization.

App

NameDescriptionDefault Value
APP_NAMEName of the applicationgofr-app
APP_ENVName of the environment file to use (e.g., stage.env, prod.env, or local.env).
APP_VERSIONApplication versiondev
LOG_LEVELLevel of verbosity for application logs. Supported values are DEBUG, INFO, NOTICE, WARN, ERROR, FATALINFO
REMOTE_LOG_URLURL to remotely change the log level
REMOTE_LOG_FETCH_INTERVALTime interval (in seconds) to check for remote log level updates15
METRICS_PORTPort on which the application exposes metrics2121
HTTP_PORTPort on which the HTTP server listens8000
GRPC_PORTPort on which the gRPC server listens9000
TRACE_EXPORTERTracing exporter to use. Supported values: gofr, zipkin, jaeger, otlp.
TRACER_HOSTHostname of the tracing collector. Required if TRACE_EXPORTER is set to zipkin or jaeger.DEPRECATED
TRACER_PORTPort of the tracing collector. Required if TRACE_EXPORTER is set to zipkin or jaeger.9411DEPRECATED
TRACER_URLURL of the trace collector. Required if TRACE_EXPORTER is set to zipkin or jaeger.
TRACER_RATIORefers to the proportion of traces that are exported through sampling. It is optional configuration. By default, this ratio is set to 1.
TRACER_AUTH_KEYAuthorization header for trace exporter requests.Supported for zipkin, jaeger.
CMD_LOGS_FILEFile to save the logs in case of a CMD application

HTTP

NameDescription
REQUEST_TIMEOUTSet the request timeouts (in seconds) for HTTP server.
CERT_FILESet the path to your PEM certificate file for the HTTPS server to establish a secure connection.
KEY_FILESet the path to your PEM key file for the HTTPS server to establish a secure connection.

Datasource

SQL

NameDescriptionDefault Value
DB_DIALECTDatabase dialect. Supported values: mysql, postgres
DB_HOSTHostname of the database server.
DB_PORTPort of the database server.3306
DB_USERUsername for the database.
DB_PASSWORDPassword for the database.
DB_NAMEName of the database to use.
DB_MAX_IDLE_CONNECTIONNumber of maximum idle connection.2
DB_MAX_OPEN_CONNECTIONNumber of maximum connections which can be used with database.0 (unlimited)
DB_SSL_MODECurrently supported only for PostgreSQL, with Default certificate file.disable

Redis

NameDescription
REDIS_HOSTHostname of the Redis server.
REDIS_PORTPort of the Redis server.

Pub/Sub

NameDescriptionDefault Value
PUBSUB_BACKENDPub/Sub message broker backendkafka, google, mqtt, nats

Kafka

NameDescriptionDefault Value
PUBSUB_BROKERComma-separated list of broker addresseslocalhost:9092
PARTITION_SIZESize of each message partition (in bytes)0
PUBSUB_OFFSETOffset to start consuming messages from. -1 for earliest, 0 for latest.-1
CONSUMER_IDUnique identifier for this consumergofr-consumer

Google

NameDescription
GOOGLE_PROJECT_IDID of the Google Cloud project. Required for Google Pub/Sub.
GOOGLE_SUBSCRIPTION_NAMEName of the Google Pub/Sub subscription. Required for Google Pub/Sub.

MQTT

NameDescriptionDefault Value
MQTT_PORTPort of the MQTT broker1883
MQTT_MESSAGE_ORDEREnable guaranteed message orderfalse
MQTT_PROTOCOLCommunication protocol. Supported values: tcp, ssl.tcp
MQTT_HOSTHostname of the MQTT brokerlocalhost
MQTT_USERUsername for the MQTT broker
MQTT_PASSWORDPassword for the MQTT broker
MQTT_CLIENT_ID_SUFFIXSuffix appended to the client ID
MQTT_QOSQuality of Service Level
MQTT_KEEP_ALIVESends regular messages to check the link is active. May not work as expected if handling func is blocking execution

NATS JetStream

NameDescriptionDefault Value
NATS_SERVERURL of the NATS servernats://localhost:4222
NATS_CREDS_FILEFile containing the NATS credentialscreds.json
Previous
Context