mirror of
https://github.com/chubin/wttr.in
synced 2024-12-24 10:53:07 +00:00
Use environment variables for configuration
This commit is contained in:
parent
ea0721ea67
commit
7bb8d58739
2 changed files with 8 additions and 8 deletions
10
README.md
10
README.md
|
@ -106,12 +106,12 @@ The `City` parameter in `~/.wegorc` is ignored.
|
|||
|
||||
### Configure wttr.in
|
||||
|
||||
Edit the `bin/srv.py` and specify the path to the local `wttr.in` installation,
|
||||
to the GeoLite database and to the `wego` installation:
|
||||
Configure the following environment variables specifing the path to the local `wttr.in`
|
||||
installation, to the GeoLite database and to the `wego` installation. For example:
|
||||
|
||||
MYDIR = "/home/igor/wttr.in"
|
||||
GEOLITE = "/home/igor/wttr.in/GeoLite2-City.mmdb"
|
||||
WEGO = "/home/igor/go/bin/wego"
|
||||
WTTR_MYDIR = "/home/igor/wttr.in"
|
||||
WTTR_GEOLITE = "/home/igor/wttr.in/GeoLite2-City.mmdb"
|
||||
WTTR_WEGO = "/home/igor/go/bin/wego"
|
||||
|
||||
|
||||
### Configure HTTP-frontend service
|
||||
|
|
|
@ -22,9 +22,9 @@ patch_all()
|
|||
from flask import Flask, request, render_template, send_from_directory
|
||||
app = Flask(__name__)
|
||||
|
||||
MYDIR = os.path.abspath(os.path.dirname( os.path.dirname('__file__') ))
|
||||
GEOLITE = os.path.join( MYDIR, "GeoLite2-City.mmdb" )
|
||||
WEGO = "/home/igor/go/bin/wego"
|
||||
MYDIR = os.environ.get('WTTR_MYDIR', os.path.abspath(os.path.dirname( os.path.dirname('__file__') )))
|
||||
GEOLITE = os.environ.get('WTTR_GEOLITE', os.path.join( MYDIR, "GeoLite2-City.mmdb" ))
|
||||
WEGO = os.environ.get('WTTR_WEGO', "/home/igor/go/bin/wego")
|
||||
|
||||
CACHEDIR = os.path.join( MYDIR, "cache" )
|
||||
IP2LCACHE = os.path.join( MYDIR, "cache/ip2l" )
|
||||
|
|
Loading…
Reference in a new issue