-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cc0f567
commit 54e0dfb
Showing
5 changed files
with
55 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# coding: utf8 | ||
|
||
from enum import Enum | ||
from flask import current_app | ||
|
||
|
||
def config(): | ||
return current_app.config["CONFIG"] | ||
|
||
|
||
class StorageBackend(Enum): | ||
FILESYSTEM = 0 | ||
POSTGRESQL = 1 | ||
|
||
@staticmethod | ||
def type() -> "StorageBackend": | ||
if config().qgisserver_projects_psql_service: | ||
return StorageBackend.POSTGRESQL | ||
return StorageBackend.FILESYSTEM | ||
|
||
|
||
def qgisserver_base_url(project: str, psql_schema: str) -> str: | ||
url = f"{config().qgisserver_url}" | ||
if StorageBackend.type() == StorageBackend.FILESYSTEM: | ||
url = f"{url}/{project}?" | ||
elif StorageBackend.type() == StorageBackend.POSTGRESQL: | ||
service = config().qgisserver_projects_psql_service | ||
url = f"{url}?MAP=postgresql:?service={service}%26schema={psql_schema}%26project={project}&" | ||
return url |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters