Skip to main content

Configuration

Client Options

Options passed to RunApplication:

c.RunApplication(ctx, myApp,
client.WithSecretKey("my-secret"), // Auth token for hugr ↔ app communication
client.WithStartupTimeout(500*time.Millisecond), // Delay before registering (default: 250ms)
)

Client Constructor Options

c := client.NewClient(url,
client.WithTimeout(5*time.Minute), // HTTP timeout (default: 5min)
client.WithApiKey("key"), // API key for hugr auth
client.WithUserRole("admin"), // User role header
)

AppInfo Fields

FieldRequiredDescription
NameYesUnique identifier. Becomes GraphQL module name
DescriptionNoHuman-readable description
VersionYesSemantic version. Changes trigger migrations
URIYesgRPC endpoint: grpc://host:port or grpc+tls://host:port
DefaultSchemaNoSchema name for top-level module (default: "default")

Environment Variables (App)

VariableDescriptionExample
HUGR_URLHugr IPC endpointhttp://localhost:15100/ipc
APP_SECRETSecret key for authenticationmy-secret-key
APP_PORTgRPC listen port50051
APP_HOSTHostname for URI registrationmy-app
APP_VERSIONApp version (if dynamic)2.0.0
PG_DSNPostgreSQL connection stringpostgres://user:pass@host/db

Environment Variables (Hugr Server)

VariableDescriptionDefault
HUGR_APP_HEARTBEAT_INTERVALTime between health checks30s
HUGR_APP_HEARTBEAT_TIMEOUTTimeout per health check10s
HUGR_APP_HEARTBEAT_RETRIESFailures before suspend3

DSN Path Format

The app's connection path stored in hugr:

grpc://host:port?secret_key=TOKEN&version=1.0.0
ParameterDescription
secret_keyMaps to Airport SECRET auth_token
versionApp version for migration tracking

Reserved Names

Cannot be used as app names:

NameReason
functionGraphQL Function root type
mutation_functionGraphQL MutationFunction root type
coreSystem functions module
_systemInternal system use
Names starting with _Reserved for internal types

DataSourceInfo.Path

Connection strings support environment variable substitution:

postgres://[$DB_USER]:[$DB_PASS]@[$DB_HOST]:5432/mydb

Variables in [$VAR] format are resolved from the hugr server's environment at provisioning time.