Skip to content

Commit

Permalink
manager: add configuration from environment
Browse files Browse the repository at this point in the history
For the development web server the environment variable
``RUAUMOKO_SETTINGS`` may now optionally be set. If it is set, it points
to a configuration file which can be used to configure the webapp
settings including, but not limited to, the path to the ruaumoko
dataset.
  • Loading branch information
rjw57 committed Oct 24, 2014
1 parent a1be06f commit 71cfc15
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,25 @@ the [GNU GPL 3](http://gplv3.fsf.org/) (see LICENSE).
Python dependences may be found in `requirements.txt`. To run the downloader
you will also require the `convert` command (from `imagemagick`).

## Running a development webserver

The ``ruaumoko-api`` command can be used to run a development web server.

```console
$ ruaumoko-api runserver
```

This will use the default configuration. To use a custom configuration to, for
example, change the dataset location use the ``RUAUMOKO_SETTINGS`` environment
variable:

```console
$ cat > ruaumoko-development.txt <<EOL
ELEVATION_DIRECTORY=/path/to/your/dataset
EOL
$ RUAUMOKO_SETTINGS=ruaumoko-development.txt ruaumoko-api runserver
```

## Dataset Format

Throughout Ruaumoko, data is indexed latitude-first/row-first
Expand Down
3 changes: 3 additions & 0 deletions ruaumoko/manager.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
"""Command-line utility to run/manage webapp."""
import os

from flask.ext.script import Manager
from .api import app

manager = Manager(app)

def main():
if 'RUAUMOKO_SETTINGS' in os.environ:
app.config.from_envvar('RUAUMOKO_SETTINGS')
manager.run()

0 comments on commit 71cfc15

Please sign in to comment.