Skip to content

Configure from command line

Naoki Takezoe edited this page Jul 30, 2018 · 6 revisions

Normally, GitBucket configuration is saved to GITBUCKET_HOME/gitbucket.conf and database connection is configured by GITBUCKET_HOME/database.conf. All configuration items of these files can be given as system properties or environmental variables too. In particular, it's useful when running GitBucket in a docker container.

For example, it's possible to run GitBucket with a specified database as follows:

$ java -Dgitbucket.db.url=jdbc:postgresql://localhost/gitbucket \
       -Dgitbucket.db.user=test \
       -Dgitbucket.db.password=test \
       -jar gitbucket.war

While system properties are used in the above example, environmental variables can be used instead:

$ export GITBUCKET_DB_URL=jdbc:postgresql://localhost/gitbucket
$ export GITBUCKET_DB_USER=test
$ export GITBUCKET_DB_PASSWORD=test
$ java -jar gitbucket.war

An another example is giving a base url which is normally configured in gitbucket.conf as system properties:

$ java -Dgitbucket.base_url=http://localhost:8080 -jar gitbucket.war

Or as environmental variables:

$ export GITBUCKET_BASE_URL=http://localhost:8080
$ java -jar gitbucket.war

GitBucket look for each configuration item in following order:

  1. System property
  2. Environment variable
  3. Configuration file

So you can overwrite specific configuration items by specifying system properties or defining environment variables.

You can’t perform that action at this time.