There are several ways you can change Hatta's configuration. The precedence of configuration options is as follows:
That means, for example, that you can override an environment variable with a command line option.
You can set the HATTA_* environment variables before running the script. The variables all start with HATTA_ and are all capitalized, other than that they have the same names as configuration variables. For example, to change the port on which
the standalone server serves the wiki, set HATTA_PORT, and to change the path where the pages are stored, set HATTA_PAGES_PATH.
Some of the settings can be changed with command line options when starting the script. Run it with the --help option to see the summary:
Usage: hatta.py [options]
Options:
-h, --help show this help message and exit
-d DIR, --pages-dir=DIR
Store pages in DIR
-t DIR, --cache-dir=DIR
Store cache in DIR
-i INT, --interface=INT
Listen on interface INT
-p PORT, --port=PORT Listen on port PORT
-s NAME, --script-name=NAME
Override SCRIPT_NAME to NAME
-n NAME, --site-name=NAME
Set the name of the site to NAME
-m PAGE, --front-page=PAGE
Use PAGE as the front page
-e ENC, --encoding=ENC
Use encoding ENS to read and write pages
-c FILE, --config-file=FILE
Read configuration from FILEIf you don't run the wiki locally, but instead use a wrapper script to run WSGI or FastCGI application, you can pass parameters to the hatta.WikiConfig object when creating it,
then create the hatta.Wiki object with it as parameter.
config = WikiConfig(
interface=''
port=8080
pages_path = 'docs'
cache_path = 'cache'
front_page = 'Home'
site_name = 'Hatta Wiki'
page_charset = 'UTF-8'
)
application = Wiki(config).application
You can edit the script directly. Open it in a text editor of your choice and scroll to the bottom. You should see lines:
config = WikiConfig(
# Here you can modify the configuration: uncomment and change the ones
# you need. Note that it's better use environment variables or command
# line switches.
# interface=''
# port=8080
# pages_path = 'docs'
# cache_path = 'cache'
# front_page = 'Home'
# site_name = 'Hatta Wiki'
# page_charset = 'UTF-8'
)
By default, Hatta looks for a file called "hatta.conf" in its current directory, and tries to read configuration from it. You can change the file name using the config_file option in any way described above.
The file consists of sections (put section name in square brackets), with options specified for every section. An example configuration file might look like this:
[Hatta]
port = 80
interface = localhost
Currently, if a file contains more than one section, all of them will be merged together. This may change in future.
You can change these to better fit your needs, for example:
interface = '127.0.0.1'
port = 2080
cache_path = '/tmp/hatta'
pages_path = '/home/sheep/my_repository/wiki_pages'