Skip to content

Commit 61c540e

Browse files
Build fixes
1 parent 8904f97 commit 61c540e

File tree

2 files changed

+49
-49
lines changed

2 files changed

+49
-49
lines changed

config.py

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,59 @@
11
import os
22
from datetime import timedelta
33

4+
def get_engine_options():
5+
"""Get database engine options based on DATABASE_URL"""
6+
database_url = os.environ.get('DATABASE_URL') or 'sqlite:///subscriptions.db'
7+
8+
if 'sqlite' in database_url.lower():
9+
# SQLite-specific settings
10+
return {
11+
'pool_timeout': 10,
12+
'pool_recycle': 3600,
13+
'pool_pre_ping': True,
14+
'connect_args': {
15+
'timeout': 20,
16+
'check_same_thread': False
17+
}
18+
}
19+
elif 'postgresql' in database_url.lower() or 'postgres' in database_url.lower():
20+
# PostgreSQL-specific settings (psycopg3 compatible)
21+
return {
22+
'pool_size': 10,
23+
'max_overflow': 20,
24+
'pool_timeout': 30,
25+
'pool_recycle': 3600,
26+
'pool_pre_ping': True,
27+
'connect_args': {
28+
'connect_timeout': 10
29+
}
30+
}
31+
elif 'mysql' in database_url.lower() or 'mariadb' in database_url.lower():
32+
# MySQL/MariaDB-specific settings
33+
return {
34+
'pool_size': 10,
35+
'max_overflow': 20,
36+
'pool_timeout': 30,
37+
'pool_recycle': 3600,
38+
'pool_pre_ping': True,
39+
'connect_args': {
40+
'charset': 'utf8mb4'
41+
}
42+
}
43+
else:
44+
# Default settings for other databases
45+
return {
46+
'pool_timeout': 30,
47+
'pool_recycle': 3600,
48+
'pool_pre_ping': True
49+
}
50+
451
class Config:
552
SECRET_KEY = os.environ.get('SECRET_KEY') or 'mad-hatter-secret-key-change-me'
653
SQLALCHEMY_DATABASE_URI = os.environ.get('DATABASE_URL') or 'sqlite:///subscriptions.db'
754
SQLALCHEMY_TRACK_MODIFICATIONS = False
855

956
# Database connection pool settings
10-
@classmethod
11-
def get_engine_options(cls):
12-
database_url = os.environ.get('DATABASE_URL') or 'sqlite:///subscriptions.db'
13-
14-
if 'sqlite' in database_url.lower():
15-
# SQLite-specific settings
16-
return {
17-
'pool_timeout': 10,
18-
'pool_recycle': 3600,
19-
'pool_pre_ping': True,
20-
'connect_args': {
21-
'timeout': 20,
22-
'check_same_thread': False
23-
}
24-
}
25-
elif 'postgresql' in database_url.lower() or 'postgres' in database_url.lower():
26-
# PostgreSQL-specific settings (psycopg3 compatible)
27-
return {
28-
'pool_size': 10,
29-
'max_overflow': 20,
30-
'pool_timeout': 30,
31-
'pool_recycle': 3600,
32-
'pool_pre_ping': True,
33-
'connect_args': {
34-
'connect_timeout': 10
35-
}
36-
}
37-
elif 'mysql' in database_url.lower() or 'mariadb' in database_url.lower():
38-
# MySQL/MariaDB-specific settings
39-
return {
40-
'pool_size': 10,
41-
'max_overflow': 20,
42-
'pool_timeout': 30,
43-
'pool_recycle': 3600,
44-
'pool_pre_ping': True,
45-
'connect_args': {
46-
'charset': 'utf8mb4'
47-
}
48-
}
49-
else:
50-
# Default settings for other databases
51-
return {
52-
'pool_timeout': 30,
53-
'pool_recycle': 3600,
54-
'pool_pre_ping': True
55-
}
56-
5757
SQLALCHEMY_ENGINE_OPTIONS = get_engine_options()
5858

5959
# Email configuration

docker-entrypoint.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ fi
2121
if id -u ${APP_USER} >/dev/null 2>&1; then
2222
EXISTING_UID=$(id -u ${APP_USER})
2323
if [ "$EXISTING_UID" != "$PUID" ]; then
24-
usermod -o -u "$PUID" ${APP_USER} || true
24+
usermod -o -u "$PUID" ${APP_USER} 2>/dev/null || true
2525
fi
2626
else
27-
useradd -o -m -u "$PUID" -g "$PGID" -s /bin/bash ${APP_USER}
27+
useradd -o -m -u "$PUID" -g "$PGID" -s /bin/bash ${APP_USER} 2>/dev/null || true
2828
fi
2929

3030
# Ensure instance and other writable dirs exist & permissions

0 commit comments

Comments
 (0)