tileserver: fixed http basic auth
This commit is contained in:
parent
fbe8671542
commit
1a178efd2e
1 changed files with 2 additions and 1 deletions
|
@ -12,6 +12,7 @@ from io import BytesIO
|
||||||
|
|
||||||
import pylibmc
|
import pylibmc
|
||||||
import requests
|
import requests
|
||||||
|
from requests.auth import HTTPBasicAuth
|
||||||
|
|
||||||
from c3nav.mapdata.utils.cache import CachePackage
|
from c3nav.mapdata.utils.cache import CachePackage
|
||||||
from c3nav.mapdata.utils.tiles import (build_access_cache_key, build_base_cache_key, build_tile_etag, get_tile_bounds,
|
from c3nav.mapdata.utils.tiles import (build_access_cache_key, build_base_cache_key, build_tile_etag, get_tile_bounds,
|
||||||
|
@ -63,7 +64,7 @@ class TileServer:
|
||||||
|
|
||||||
self.http_auth = os.environ.get('C3NAV_HTTP_AUTH', None)
|
self.http_auth = os.environ.get('C3NAV_HTTP_AUTH', None)
|
||||||
if self.http_auth:
|
if self.http_auth:
|
||||||
self.http_auth = self.http_auth.split(':', 1)
|
self.http_auth = HTTPBasicAuth(*self.http_auth.split(':', 1))
|
||||||
|
|
||||||
self.auth_headers = {'X-Tile-Secret': base64.b64encode(self.tile_secret.encode()).decode()}
|
self.auth_headers = {'X-Tile-Secret': base64.b64encode(self.tile_secret.encode()).decode()}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue