Compare commits
4 Commits
4926433c35
...
025cd975f0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
025cd975f0 | ||
|
|
0b02b435ef | ||
|
|
c52dbf618e | ||
|
|
2b1f7e3a38 |
@@ -3,5 +3,8 @@ POSTGRES_HOSTNAME=postgres_host
|
|||||||
POSTGRES_PORT=postgres_port
|
POSTGRES_PORT=postgres_port
|
||||||
POSTGRES_DB=postgres_database
|
POSTGRES_DB=postgres_database
|
||||||
POSTGRES_USER=postgres_user
|
POSTGRES_USER=postgres_user
|
||||||
POSTGRES_PASSWORD=
|
POSTGRES_PASSWORD=xxxx
|
||||||
ADMIN_PASSWORD=
|
|
||||||
|
ADMIN_PASSWORD=xxxxx
|
||||||
|
|
||||||
|
MUNICIPALITY_SLUG=lohne
|
||||||
@@ -11,6 +11,17 @@
|
|||||||
// - Analytics Tab
|
// - Analytics Tab
|
||||||
// =====================================================================
|
// =====================================================================
|
||||||
|
|
||||||
|
// Reads Environment Configfile
|
||||||
|
$envFile = __DIR__ . '/../../.env';
|
||||||
|
if (file_exists($envFile)) {
|
||||||
|
$lines = file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||||
|
foreach ($lines as $line) {
|
||||||
|
if (strpos(trim($line), '#') === 0) continue;
|
||||||
|
list($key, $value) = array_map('trim', explode('=', $line, 2));
|
||||||
|
putenv("$key=$value");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
require_once __DIR__ . '/api/db.php';
|
require_once __DIR__ . '/api/db.php';
|
||||||
require_once __DIR__ . '/api/auth.php';
|
require_once __DIR__ . '/api/auth.php';
|
||||||
|
|
||||||
@@ -43,7 +54,7 @@ if ($page === 'logout') {
|
|||||||
// -----------------------------------------------------------------
|
// -----------------------------------------------------------------
|
||||||
$pdo = get_db();
|
$pdo = get_db();
|
||||||
$stmt = $pdo->prepare("SELECT * FROM municipalities WHERE slug = :slug");
|
$stmt = $pdo->prepare("SELECT * FROM municipalities WHERE slug = :slug");
|
||||||
$stmt->execute([':slug' => 'lohne']);
|
$stmt->execute([':slug' => getenv('MUNICIPALITY_SLUG')]);
|
||||||
$municipality = $stmt->fetch();
|
$municipality = $stmt->fetch();
|
||||||
|
|
||||||
// Shows Login Page if not authenticated
|
// Shows Login Page if not authenticated
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ try {
|
|||||||
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
|
||||||
PDO::ATTR_EMULATE_PREPARES => false
|
PDO::ATTR_EMULATE_PREPARES => false
|
||||||
];
|
];
|
||||||
$dsn = "pgsql:host=$host;dbname=$db;port=$port";
|
$dsn = "pgsql:host=$host;dbname=$db;port=$port;sslmode=disable";
|
||||||
$pdo = new PDO($dsn, $user, $pass, $opt);
|
$pdo = new PDO($dsn, $user, $pass, $opt);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,17 @@
|
|||||||
// Renders Leaflet Map Interface including Leaflet Plugins
|
// Renders Leaflet Map Interface including Leaflet Plugins
|
||||||
// =====================================================================
|
// =====================================================================
|
||||||
|
|
||||||
|
// Reads Environment Configfile
|
||||||
|
$envFile = __DIR__ . '/../../.env';
|
||||||
|
if (file_exists($envFile)) {
|
||||||
|
$lines = file($envFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
|
||||||
|
foreach ($lines as $line) {
|
||||||
|
if (strpos(trim($line), '#') === 0) continue;
|
||||||
|
list($key, $value) = array_map('trim', explode('=', $line, 2));
|
||||||
|
putenv("$key=$value");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
require_once __DIR__ . '/api/db.php';
|
require_once __DIR__ . '/api/db.php';
|
||||||
|
|
||||||
// -----------------------------------------------------------------
|
// -----------------------------------------------------------------
|
||||||
@@ -14,7 +25,7 @@ require_once __DIR__ . '/api/db.php';
|
|||||||
// -----------------------------------------------------------------
|
// -----------------------------------------------------------------
|
||||||
$pdo = get_db();
|
$pdo = get_db();
|
||||||
$stmt = $pdo->prepare("SELECT * FROM municipalities WHERE slug = :slug");
|
$stmt = $pdo->prepare("SELECT * FROM municipalities WHERE slug = :slug");
|
||||||
$stmt->execute([':slug' => 'lohne']);
|
$stmt->execute([':slug' => getenv('MUNICIPALITY_SLUG')]);
|
||||||
$municipality = $stmt->fetch();
|
$municipality = $stmt->fetch();
|
||||||
|
|
||||||
if (!$municipality) {
|
if (!$municipality) {
|
||||||
|
|||||||
Reference in New Issue
Block a user