chore: remove .env file
This commit is contained in:
1 parent
cc9b2beaf8
commit
1510413a16
10 files changed
+74
-63
No files matched your search
@@ -1,8 +1,14 @@
|
||||
# Copy this file to `.env` and adjust the values for your environment.
|
||||
# `.env` is gitignored and must never be committed.
|
||||
|
||||
LOGIN_DB_PORT=20011
|
||||
LOGIN_DB_NAME=openmmo_login_db
|
||||
LOGIN_DB_USER=openmmo_login_user
|
||||
LOGIN_DB_PASSWORD=changeMe!
|
||||
|
||||
GAME_DB_PORT=20021
|
||||
GAME_DB_NAME=openmmo_game_db
|
||||
GAME_DB_USER=openmmo_game_user
|
||||
GAME_DB_PASSWORD=changeMe!
|
||||
|
||||
OPENMMO_SESSION_SECRET=
|
||||
@@ -40,3 +40,10 @@ bin/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
||||
|
||||
+### Local environment / secrets ###
|
||||
+# Never commit local config or secrets. Use `.env.example` as the template.
|
||||
+.env
|
||||
+.env.*
|
||||
+!.env.example
|
||||
+docker-compose.override.yml
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
## ToC
|
||||
- [Description](#description)
|
||||
- [Configuration](#configuration)
|
||||
- [Documentation](#wiki)
|
||||
- [License](LICENSE)
|
||||
- [Disclaimer](#disclaimer)
|
||||
@@ -15,6 +16,23 @@
|
||||
OpenMMO is an open-source implementation of the PokeMMO server.
|
||||
The goal is it to provide a free and open-source alternative to the PokeMMO server.
|
||||
|
||||
## Configuration
|
||||
|
||||
All local configuration and secrets live in a `.env` file at the repository
|
||||
root. It is **gitignored**, never commit it. Use the tracked
|
||||
[`.env.example`](.env.example) as the template:
|
||||
|
||||
```bash
|
||||
cp .env.example .env # then edit the values
|
||||
docker compose up -d # start all docker containers
|
||||
./gradlew runAll # build and run the servers
|
||||
```
|
||||
|
||||
For local-only tweaks to the container setup, create a
|
||||
`docker-compose.override.yml` (also gitignored).
|
||||
Docker Compose merges it automatically on `docker compose up`.
|
||||
For deployment,supply a proper `.env` and run `docker compose -f docker-compose.yml up -d` to skip any override.
|
||||
|
||||
## Wiki
|
||||
|
||||
The documentation wiki can be found [here](https://forge.fiereu.de/OpenMMO/OpenMMO/wiki).
|
||||
|
||||
+2
-32
@@ -1,33 +1,3 @@
|
||||
allprojects {
|
||||
beforeEvaluate {
|
||||
loadEnvFile("${rootDir.absolutePath}/.env")
|
||||
}
|
||||
}
|
||||
|
||||
fun loadEnvFile(fileName: String) {
|
||||
val file = rootProject.file(fileName)
|
||||
if (file.exists()) {
|
||||
file.forEachLine { line ->
|
||||
if (line.isNotBlank() && !line.startsWith("#")) {
|
||||
val parts = line.split("=", limit = 2)
|
||||
if (parts.size == 2) {
|
||||
System.setProperty(parts[0].trim(), parts[1].trim())
|
||||
} else {
|
||||
throw IllegalArgumentException("Invalid line in env file: $line")
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
throw IllegalArgumentException("Env file '$fileName' does not exist.")
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register("runAll") {
|
||||
group = "application"
|
||||
description = "Runs all servers and the patcher"
|
||||
listOf(
|
||||
":server.login:run",
|
||||
":server.game:run",
|
||||
":patcher:run"
|
||||
).forEach { dependsOn(it) }
|
||||
plugins {
|
||||
alias(libs.plugins.dotenv)
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
services:
|
||||
login-db:
|
||||
image: postgres:latest
|
||||
container_name: login-db
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_DB: $LOGIN_DB_NAME
|
||||
POSTGRES_USER: $LOGIN_DB_USER
|
||||
POSTGRES_PASSWORD: $LOGIN_DB_PASSWORD
|
||||
ports:
|
||||
- $LOGIN_DB_PORT:5432
|
||||
game-db:
|
||||
image: postgres:latest
|
||||
container_name: game-db
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_DB: $GAME_DB_NAME
|
||||
POSTGRES_USER: $GAME_DB_USER
|
||||
POSTGRES_PASSWORD: $GAME_DB_PASSWORD
|
||||
ports:
|
||||
- $GAME_DB_PORT:5432
|
||||
@@ -0,0 +1,29 @@
|
||||
services:
|
||||
login-db:
|
||||
image: postgres:18
|
||||
container_name: login-db
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_DB: ${LOGIN_DB_NAME:-openmmo_login_db}
|
||||
POSTGRES_USER: ${LOGIN_DB_USER:-openmmo_login_user}
|
||||
POSTGRES_PASSWORD: ${LOGIN_DB_PASSWORD:?LOGIN_DB_PASSWORD is required (see .env.example)}
|
||||
ports:
|
||||
- ${LOGIN_DB_PORT:-20011}:5432
|
||||
volumes:
|
||||
- login_db_data:/var/lib/postgresql
|
||||
game-db:
|
||||
image: postgres:18
|
||||
container_name: game-db
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_DB: ${GAME_DB_NAME:-openmmo_game_db}
|
||||
POSTGRES_USER: ${GAME_DB_USER:-openmmo_game_user}
|
||||
POSTGRES_PASSWORD: ${GAME_DB_PASSWORD:?GAME_DB_PASSWORD is required (see .env.example)}
|
||||
ports:
|
||||
- ${GAME_DB_PORT:-20021}:5432
|
||||
volumes:
|
||||
- game_db_data:/var/lib/postgresql
|
||||
|
||||
volumes:
|
||||
login_db_data:
|
||||
game_db_data:
|
||||
@@ -1,16 +1,6 @@
|
||||
org.gradle.caching=true
|
||||
org.gradle.configuration-cache=true
|
||||
|
||||
# Database settings
|
||||
openmmo.db.login.port=${LOGIN_DB_PORT}
|
||||
openmmo.db.login.name=${LOGIN_DB_NAME}
|
||||
openmmo.db.login.user=${LOGIN_DB_USER}
|
||||
openmmo.db.login.password=${LOGIN_DB_PASSWORD}
|
||||
openmmo.db.game.port=${GAME_DB_PORT}
|
||||
openmmo.db.game.name=${GAME_DB_NAME}
|
||||
openmmo.db.game.user=${GAME_DB_USER}
|
||||
openmmo.db.game.password=${GAME_DB_PASSWORD}
|
||||
|
||||
# PokeMMO constants
|
||||
pokemmo.mainClass=com.pokeemu.client.Client
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ typesafe-config = "1.4.4"
|
||||
dagger = "2.57"
|
||||
ksp = "2.3.8"
|
||||
ineter = "0.3.1"
|
||||
dotenv = "4.0.0"
|
||||
|
||||
[libraries]
|
||||
kotlinGradlePlugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
|
||||
@@ -69,3 +70,4 @@ kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", versi
|
||||
jooq = { id = "org.jooq.jooq-codegen-gradle", version.ref = "jooq" }
|
||||
flyway = { id = "org.flywaydb.flyway", version.ref = "flyway" }
|
||||
ksp = { id = "com.google.devtools.ksp", version.ref = "ksp" }
|
||||
dotenv = { id = "co.uzzu.dotenv.gradle", version.ref = "dotenv" }
|
||||
@@ -31,6 +31,11 @@ dependencies {
|
||||
testImplementation(libs.kotlinx.coroutines.test)
|
||||
}
|
||||
|
||||
tasks.named<JavaExec>("run") {
|
||||
listOf("OPENMMO_SESSION_SECRET", "GAME_DB_PORT", "GAME_DB_NAME", "GAME_DB_USER", "GAME_DB_PASSWORD")
|
||||
.forEach { key -> env.fetchOrNull(key)?.let { environment(key, it) } }
|
||||
}
|
||||
|
||||
listOf("classes", "processResources").forEach { taskName ->
|
||||
tasks.named(taskName) { dependsOn("copyPublicKeyGame", "copyPrivateKeyGame") }
|
||||
}
|
||||
@@ -30,6 +30,11 @@ dependencies {
|
||||
testImplementation(libs.kotlinx.coroutines.test)
|
||||
}
|
||||
|
||||
tasks.named<JavaExec>("run") {
|
||||
listOf("OPENMMO_SESSION_SECRET", "LOGIN_DB_PORT", "LOGIN_DB_NAME", "LOGIN_DB_USER", "LOGIN_DB_PASSWORD")
|
||||
.forEach { key -> env.fetchOrNull(key)?.let { environment(key, it) } }
|
||||
}
|
||||
|
||||
listOf("classes", "processResources").forEach { taskName ->
|
||||
tasks.named(taskName) { dependsOn("copyPublicKeyGame", "copyPrivateKeyGame") }
|
||||
}
|
||||
Reference in new issue
Block a user