Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,6 @@ Thumbs.db
# Docker
docker-compose.override.yml
.pip-cache/

# Build artifacts
build/
1 change: 1 addition & 0 deletions _codeql_detected_source_root
13 changes: 11 additions & 2 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include <string>
#include <cstdlib> // for getenv()
#include <iostream> // for std::cerr

// Global configuration
const int PORT = 8080;
Expand Down Expand Up @@ -59,10 +60,18 @@ inline std::string get_pg_db() {

inline std::string get_pg_user() {
const char* u = getenv("POSTGRES_USER");
return u ? u : "jic";
if (!u) {
std::cerr << "WARNING: Using default database user. Set POSTGRES_USER environment variable for production." << std::endl;
return "jic";
}
return u;
}

inline std::string get_pg_password() {
const char* p = getenv("POSTGRES_PASSWORD");
return p ? p : "jic_password";
if (!p) {
std::cerr << "WARNING: Using default database password. Set POSTGRES_PASSWORD environment variable for production." << std::endl;
return "jic_password";
}
return p;
}
Loading