Skip to content

Commit ca02ae6

Browse files
committed
Standardize environment variable naming convention to KOTBUSTA_*
- Updated `.env.example` to use `KOTBUSTA_` prefix for consistency. - Modified application configuration and codebase to reflect new variable names. - Updated `docker-compose.dev.yml` to use prefixed environment variables.
1 parent e66e623 commit ca02ae6

4 files changed

Lines changed: 23 additions & 28 deletions

File tree

.env.example

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Google OAuth credentials
22
# Get these from https://console.developers.google.com/
3-
GOOGLE_CLIENT_ID=your_google_client_id_here
4-
GOOGLE_CLIENT_SECRET=your_google_client_secret_here
5-
GOOGLE_REDIRECT_URI=http://localhost:8080/callback
3+
KOTBUSTA_GOOGLE_CLIENT_ID=your_google_client_id_here
4+
KOTBUSTA_GOOGLE_CLIENT_SECRET=your_google_client_secret_here
5+
KOTBUSTA_GOOGLE_REDIRECT_URI=http://localhost:8080/callback
66

77
# Session sign and encrypt keys
88
# Keys will be generated by the app, if none provided
9-
SESSION_SIGN_KEY=
10-
SESSION_ENCRYPT_KEY=
9+
KOTBUSTA_SESSION_SIGN_KEY=
10+
KOTBUSTA_SESSION_ENCRYPT_KEY=
1111

1212
# Database connection settings
1313
KOTBUSTA_POSTGRES_HOST=localhost
@@ -17,7 +17,7 @@ KOTBUSTA_POSTGRES_PASSWORD=kotbusta
1717
KOTBUSTA_POSTGRES_DATABASE=kotbusta
1818

1919
# Books data path (required - path to your flibusta data)
20-
BOOKS_DATA_PATH=/path/to/your/flibusta/books
20+
KOTBUSTA_BOOKS_DATA_PATH=/path/to/your/flibusta/books
2121

2222
# Admin email address used for granting administrative privileges
23-
ADMIN_EMAIL=your_admin_email_here
23+
KOTBUSTA_ADMIN_EMAIL=your_admin_email_here
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ services:
99
mem_limit: "128m"
1010
memswap_limit: "0m"
1111
environment:
12-
POSTGRES_PASSWORD: "kotbusta"
13-
POSTGRES_USER: "kotbusta"
14-
POSTGRES_DB: "kotbusta"
12+
POSTGRES_PASSWORD: "${KOTBUSTA_POSTGRES_PASSWORD}"
13+
POSTGRES_USER: "${KOTBUSTA_POSTGRES_USER}"
14+
POSTGRES_DB: "${KOTBUSTA_POSTGRES_DATABASE}"
1515
volumes:
1616
- "pgdata:/var/lib/postgresql/data"
1717
ports:

src/main/kotlin/io/heapy/kotbusta/ApplicationFactory.kt

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,16 @@ class ApplicationFactory(
4949
}
5050

5151
val adminEmail by bean {
52-
env["ADMIN_EMAIL"]
53-
}
54-
55-
val databasePath by bean {
56-
env["DATABASE_PATH"]
57-
?: "data/database/kotbusta.db"
52+
env["KOTBUSTA_ADMIN_EMAIL"]
5853
}
5954

6055
val googleOauthConfig by bean {
61-
val clientId = env["GOOGLE_CLIENT_ID"]
62-
?: error("GOOGLE_CLIENT_ID not found")
63-
val clientSecret = env["GOOGLE_CLIENT_SECRET"]
64-
?: error("GOOGLE_CLIENT_SECRET not found")
65-
val redirectUri = env["GOOGLE_REDIRECT_URI"]
66-
?: error("GOOGLE_REDIRECT_URI not found")
56+
val clientId = env["KOTBUSTA_GOOGLE_CLIENT_ID"]
57+
?: error("KOTBUSTA_GOOGLE_CLIENT_ID not found")
58+
val clientSecret = env["KOTBUSTA_GOOGLE_CLIENT_SECRET"]
59+
?: error("KOTBUSTA_GOOGLE_CLIENT_SECRET not found")
60+
val redirectUri = env["KOTBUSTA_GOOGLE_REDIRECT_URI"]
61+
?: error("KOTBUSTA_GOOGLE_REDIRECT_URI not found")
6762

6863
GoogleOauthConfig(
6964
clientId = clientId,
@@ -73,7 +68,7 @@ class ApplicationFactory(
7368
}
7469

7570
val booksDataPath by bean {
76-
env["BOOKS_DATA_PATH"]
71+
env["KOTBUSTA_BOOKS_DATA_PATH"]
7772
?.let(::Path)
7873
?: Path("data", "books")
7974
}
@@ -89,13 +84,13 @@ class ApplicationFactory(
8984
.toHexString()
9085
}
9186

92-
val sessionSignKey = env["SESSION_SIGN_KEY"]
87+
val sessionSignKey = env["KOTBUSTA_SESSION_SIGN_KEY"]
9388
?: generateRandomKey(32).also {
94-
log.info("Generated SESSION_SIGN_KEY=$it, add to env to persist")
89+
log.info("Generated KOTBUSTA_SESSION_SIGN_KEY=$it, add to env to persist")
9590
}
96-
val sessionEncryptKey = env["SESSION_ENCRYPT_KEY"]
91+
val sessionEncryptKey = env["KOTBUSTA_SESSION_ENCRYPT_KEY"]
9792
?: generateRandomKey(16).also {
98-
log.info("Generated SESSION_ENCRYPT_KEY=$it, add to env to persist")
93+
log.info("Generated KOTBUSTA_SESSION_ENCRYPT_KEY=$it, add to env to persist")
9994
}
10095

10196
SessionConfig(

src/main/resources/application.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
ktor {
22
deployment {
33
port = 8080
4-
port = ${?PORT}
4+
port = ${?KOTBUSTA_PORT}
55
}
66

77
application {

0 commit comments

Comments
 (0)