# Script settings

There are several ways you can change Hatta's configuration. The precedence of configuration options is as follows:

• command line options
• environment variables
• script or wrapper variables

That means, for example, that you can override an environment variable with a command line option.

## Setting environment variables

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.

## Command line options

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:

\$ python -m hatta --help
Usage: __main__.py [options]

Options:
-h, --help            show this help message and exit
-V, --version         Display version and exit
-d DIR, --pages-dir=DIR
Store pages in DIR
-R DIR, --repo-dir=DIR
Use the repository at 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 ENC to read and write pages
-c FILE, --config-file=FILE
-l LANG, --language=LANG
Translate interface to LANG
-g PAGE, --icon-page=PAGE
-I, --ignore-indent   Treat indented lines as normal text
-P STYLE, --pygments-style=STYLE
Use the STYLE pygments style for highlighting
-D, --subdirectories  Store subpages as subdirectories in the filesystem
-E EXTENSION, --extension=EXTENSION
Extension to add to wiki page files
-U, --unix-eol        Convert all text pages to UNIX-style CR newlines
A public key KEY for ReCAPTCHA service.
A private key KEY for ReCAPTCHA service.


## Editing the wrapper script

If 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',
repo_path = 'docs',
cache_path = 'cache',
front_page = 'Home',
site_name = 'Hatta Wiki',
page_charset = 'UTF-8'
)
application = Wiki(config).application


## Editing the script

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',
# repo_path = 'docs',
# cache_path = 'cache',
# front_page = 'Home',
# site_name = 'Hatta Wiki',
# page_charset = 'UTF-8'
)


## Configuration file

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.

## Examples

You can change these to better fit your needs, for example:

• make the wiki only available from the local computer:
    interface = '127.0.0.1'

• run on different port (note that you can't run on ports below 1024 if you are not root):
    port = 2080

• keep the cache outside of your repository:
    cache_path = '/tmp/hatta'

• specify absolute path for the directory with your pages:
    pages_path = '/home/sheep/my_repository/wiki_pages'

• specify the location of the repository where the pages are to be commited:
    repo_path = '/home/sheep/my_repository'