- log = logging.getLogger()
- webdir = str(project_dir / 'website')
- query_string = urlencode(params or {})
-
- env = dict(QUERY_STRING=query_string,
- SCRIPT_NAME='/{}.php'.format(endpoint),
- REQUEST_URI='/{}.php?{}'.format(endpoint, query_string),
- CONTEXT_DOCUMENT_ROOT=webdir,
- SCRIPT_FILENAME='{}/{}.php'.format(webdir, endpoint),
- HTTP_HOST='localhost',
- HTTP_USER_AGENT='nominatim-tool',
- REMOTE_ADDR='0.0.0.0',
- DOCUMENT_ROOT=webdir,
- REQUEST_METHOD='GET',
- SERVER_PROTOCOL='HTTP/1.1',
- GATEWAY_INTERFACE='CGI/1.1',
- REDIRECT_STATUS='CGI')
-
- if extra_env:
- env.update(extra_env)
-
- if phpcgi_bin is None:
- cmd = ['/usr/bin/env', 'php-cgi']
+ env = get_pg_env(options['dsn'])
+ cmd = [str(options['osm2pgsql']),
+ '--slim',
+ '--log-progress', 'true',
+ '--number-processes', '1' if options['append'] else str(options['threads']),
+ '--cache', str(options['osm2pgsql_cache']),
+ '--style', str(options['osm2pgsql_style'])
+ ]
+
+ if str(options['osm2pgsql_style']).endswith('.lua'):
+ env['LUA_PATH'] = ';'.join((str(options['osm2pgsql_style_path'] / '?.lua'),
+ os.environ.get('LUAPATH', ';')))
+ cmd.extend(('--output', 'flex'))