Skip to main content

Running the Tools

Configuration files​

Glean tools use some configuration files. Mostly these are optional, if you don't provide the file then a set of defaults will be assumed.

Config files are represented as JSON-encoded Thrift values. Each configuration file has a corresponding Thrift definition file, which we'll link to in the docs below.

The location of a config file is specified by a command line option, e.g. Glean clients have a --client-config option:

--client-config (file:PATH | config:PATH)

the alternatives are:

  • Omit the flag: default values will be used.
  • --client-config file:PATH means the config is read, once, from PATH.
  • --client-config config:PATH means the config is read from DIR/PATH where DIR defaults to $HOME/.config/glean but can be changed with the --config-dir DIR flag. Additionally, changes in the file are picked up without restarting the tool. (this is particularly useful for the server)

The idea is that if you're running a fleet of Glean servers, you can have a set of configuration files that you sync to all the hosts in your fleet using whatever mechanism you want, and set --config-dir to point to the location of the files. If this isn't sufficient, then you can implement your own ConfigProvider instance to support whatever method you need for accessing config files.

Common options​

All the Glean tools (glean, glean-server) accept the following options.

Connecting to a remote server​

  • --service HOST:PORT
    Default: taken from --client-config
    Specifies the Glean server to connect to.
  • --client-config (file:PATH | config:PATH)
    Default:config:client or use default values if missing
    Thrift file: client-config.thrift
    The location of the client configuration file, which specifies the default Glean server to connect to, amongst other things.

Using local databases​

  • --db-root DIR
    The path where Glean databases are stored.

  • --schema (file:FILE | dir:DIR | config:PATH | DIR)
    Default: config:schema
    The location of the schema definition. This can either be:

    • dir:DIR or just DIR
      All the files with the extension .angle under DIR (or in subdirectories) will be read.
    • file:FILE or config:PATH
      A single file, which can be created from the source files in DIR by running gen-schema --dir DIR --source FILE
      If you are running a fleet of Glean servers, you would normally sync schema changes across the fleet by putting the schema in config:schema.
  • --schema-version VERSION

  • --server-config (file:PATH | config:PATH)
    Default: config:server
    Thrift file: server-config.thrift

  • --tier TIER
    Equivalent to --server-config config:server/TIER
    Can be handy when you have fleet-wide configuration files but you want certain servers to have different configs.

  • --db-read-only
    Disable writing to databases. This is useful if you have servers that only serve queries, and should not be creating or writing databases.

  • --enable-logging
    Enable logging of all operations. (Note that there is currently no logging backend implemented for the open-source build of Glean, so this doesn't do anything yet).

Testing options​

  • --db-schema-override
    The current schema will override the schema in the database. Normally you don't want this, because the schema stored in the database is the one that was active at the time when the DB was created, so it is likely to be a correct description of the data in the database.

  • --db-mock-writes
    Allow write operations, but discard the data and don't write it to the DB.