tib.conf and the profiles file profiles.json. TIB can also be managed via the TIB REST API for automated configurations.
The tib.conf file
Omitting the configuration file
From TIB v1.3.1, the environment variableTYK_IB_OMITCONFIGFILE is provided to allow the configuration file to be omitted (ignored) when configuring TIB.
If set to TRUE, then TIB will ignore any provided configuration file and set its parameters according to environment variables. TIB will fall back to the default value for any parameters not set in an environment variable.
This is particularly useful when using Docker, as this option will ensure that TIB will load the configuration via env vars and not expect a configuration file.
Environment Variable Type Mapping
When configuring Tyk components using environment variables, it’s important to understand how different data types are represented. The type of each variable is based on its definition in the Go source code. This section provides a guide on how to format values for common data types.| Go Type | Environment Variable Format | Example |
|---|---|---|
string | A regular string of text. | TYK_GW_SECRET="mysecret" |
int, int64 | A whole number. | TYK_GW_LISTENPORT=8080 |
bool | true or false. | TYK_GW_USEDBAPPCONFIG=true |
[]string | A comma-separated list of strings. | TYK_PMP_PUMPS_STDOUT_FILTERS_SKIPPEDAPIIDS="api1,api2,api3" |
map[string]string | A comma-separated list of key:value pairs. | TYK_GW_GLOBALHEADERS="X-Tyk-Test:true,X-Tyk-Version:1.0" |
map[string]interface{} | A JSON string representing the object. | TYK_GW_POLICIES_POLICYSOURCE_CONFIG='{"connection_string": "..."}' |
For complex types like
map[string]interface{}, the value should be a valid JSON string. For []string and map[string]string, ensure there are no spaces around the commas unless they are part of the value itself.tib.conf file are:
Secret
ENV: TYK_IB_SECRETType:
stringThe REST API secret to configure the Tyk Identity Broker remotely.
ProfileDir
ENV: TYK_IB_PROFILEDIRType:
stringDirectory where the backup files will be stored. Backups files are created each time that a create, update or delete action is performed over any profile (and profiles are being read from a file not from mongo, in which case it will create a new document in the
profiles_backup collection).
HttpServerOptions.UseSSL
ENV: TYK_IB_HTTPSERVEROPTIONS_USESSLType:
boolSet this to
true to turn on SSL for the server, this is highly recommended.
HttpServerOptions.KeyFile
ENV: TYK_IB_HTTPSERVEROPTIONS_KEYFILEType:
stringThe path to the key file for this server, required for SSL.
HttpServerOptions.CertFile
ENV: TYK_IB_HTTPSERVEROPTIONS_CERTFILEType:
stringThe path to the certificate file for this server, required for SSL.
BackEnd
TIB is quite modular and different back-ends can be generated quite easily. By default, TIB will store profile configurations in memory, which does not require any new configuration. For Identity Handlers that provide token-based access, it is possible to enforce a “One token per provider, per user” policy, which keeps a cache of tokens assigned to identities in Redis, this is so that the broker can be scaled and share the cache across instances. Since profiles are unlikely to change often, profiles are kept in-memory, but can be added, removed and modified using an API for automated setups if required.BackEnd.IdentityBackendSettings.Database
ENV: TYK_IB_BACKEND_IDENTITYBACKENDSETTINGS_DATABASEType:
intIf you are using multiple databases (not supported in Redis cluster), let TIB know which DB to use for Identity caching.
BackEnd.IdentityBackendSettings.Username
ENV: TYK_IB_BACKEND_IDENTITYBACKENDSETTINGS_USERNAMEType:
stringThe username for Redis AUTH, if used (recommended).
BackEnd.IdentityBackendSettings.Password
ENV: TYK_IB_BACKEND_IDENTITYBACKENDSETTINGS_PASSWORDType:
stringThe password for your Redis AUTH Username.
BackEnd.IdentityBackendSettings.Hosts
ENV: TYK_IB_BACKEND_IDENTITYBACKENDSETTINGS_HOSTSType:
map[string]stringAdd your Redis hosts here as a map of hostname:port. Since TIB uses the same cluster driver as Tyk, it is possible to have TIB interact with your existing Redis cluster if you enable it.
To set this value via env var you must follow the declaration syntax
export TYK_IB_BACKEND_IDENTITYBACKENDSETTINGS_HOSTS="host1:port,host2:port"BackEnd.IdentityBackendSettings.MaxIdle
ENV: TYK_IB_BACKEND_IDENTITYBACKENDSETTINGS_MAXIDLEType:
intMax idle connections to Redis.
BackEnd.IdentityBackendSettings.MaxActive
ENV: TYK_IB_BACKEND_IDENTITYBACKENDSETTINGS_MAXACTIVEType:
intMax active Redis connections.
BackEnd.IdentityBackendSettings.EnableCluster
ENV: TYK_IB_BACKEND_IDENTITYBACKENDSETTINGS_ENABLECLUSTERType:
boolIf you are using Redis cluster, enable it here to enable the slots mode.
BackEnd.IdentityBackendSettings.UseSSL
ENV: TYK_IB_BACKEND_IDENTITYBACKENDSETTINGS_USESSLType:
boolIf you are using a TLS protected Redis enable to connect.
This option is available from TIB v0.4.0
BackEnd.IdentityBackendSettings.SSLInsecureSkipVerify
ENV: TYK_IB_BACKEND_IDENTITYBACKENDSETTINGS_SSLINSECURESKIPVERIFYType:
boolAllows usage of self-signed certificates when connecting to an encrypted Redis database.
This option is available from TIB v0.4.0
Storage
Storage.storage_type
ENV: TYK_IB_STORAGE_STORAGE_TYPEType:
stringConfigures the storage backend for TIB profiles. By default, profiles are loaded from the file specified by the
-p flag. Set storage_type to mongo to load profiles from MongoDB instead.
Storage.mongo.mongo_url
ENV: TYK_IB_STORAGE_MONGO_MONGO_URLType:
stringThe MongoDB connection string.
Storage.mongo.db_name
ENV: TYK_IB_STORAGE_MONGO_DB_NAMEType:
stringThe MongoDB database name to use for profile storage.
Storage.mongo.mongo_use_ssl
ENV: TYK_IB_STORAGE_MONGO_MONGO_USE_SSLType:
boolSet to
true to enable TLS for the MongoDB connection. TIB will verify the server certificate against system CAs.
Storage.mongo.mongo_ssl_insecure_skip_verify
ENV: TYK_IB_STORAGE_MONGO_MONGO_SSL_INSECURE_SKIP_VERIFYType:
boolSet to
true to skip TLS certificate verification. Not recommended for production.
Storage.mongo.driver
ENV: TYK_IB_STORAGE_MONGO_DRIVERType:
stringThe MongoDB driver to use. Valid values:
mongo-go (default) or mgo.
Storage.mongo.session_consistency
ENV: TYK_IB_STORAGE_MONGO_SESSION_CONSISTENCYType:
stringThe MongoDB session consistency level.
Storage.mongo.direct_connection
ENV: TYK_IB_STORAGE_MONGO_DIRECT_CONNECTIONType:
boolSet to
true to connect directly to a single MongoDB host, bypassing replica set discovery.
TykAPISettings
This section enables you to configure the API credentials for the various Tyk Components TIB is interacting with.TykAPISettings.GatewayConfig.Endpoint
ENV: TYK_IB_TYKAPISETTINGS_GATEWAYCONFIG_ENDPOINTType:
stringThe hostname of the Tyk Gateway (this is for token generation purposes).
TykAPISettings.GatewayConfig.Port
ENV: TYK_IB_TYKAPISETTINGS_GATEWAYCONFIG_PORTType:
stringThe port to use on the Tyk Gateway host.
For HTTP or HTTPS endpoints, you do not need to specify the default ports (80 and 443) for this setting. These two ports are handled automatically.
TykAPISettings.GatewayConfig.AdminSecret
ENV: TYK_IB_TYKAPISETTINGS_GATEWAYCONFIG_ADMINSECRETType:
stringThe API secret for the Tyk Gateway REST API.
TykAPISettings.DashboardConfig.Endpoint
ENV: TYK_IB_TYKAPISETTINGS_DASHBOARDCONFIG_ENDPOINTType:
stringThe hostname of your Dashboard (Advanced API).
TykAPISettings.DashboardConfig.Port
ENV: TYK_IB_TYKAPISETTINGS_DASHBOARDCONFIG_PORTType:
stringThe port of your Advanced API.
TykAPISettings.DashboardConfig.AdminSecret
ENV: TYK_IB_TYKAPISETTINGS_DASHBOARDCONFIG_ADMINSECRETType:
stringThe high-level secret for the Advanced API. This is required because of the SSO-nature of some of the actions provided by TIB, it requires the capability to access a special SSO endpoint in the Advanced API to create one-time tokens for access.