Dockerize Nebula (#31)

* feat: introduce docker and compose

* feat: add public host/port env var

Added `NEBULA_PUBLIC_HOST` and `NEBULA_PUBLIC_PORT` environment variables. Will override config values.

* chore: update compose manifest

Add `NEBULA_PUBLIC_PORT` environment variable for serverlist.
This commit is contained in:
Fishia
2026-04-23 03:09:23 -07:00
committed by GitHub
parent 995f67e86c
commit 8f07ae06d8
6 changed files with 93 additions and 4 deletions
+20 -1
View File
@@ -36,13 +36,24 @@ public class Config {
public String uri = "mongodb://localhost:27017";
public String collection = "nebula";
public boolean useInternal = true;
public String getConnectionString() {
if (System.getenv("NEBULA_MONGODB_HOST") != null) {
int port = 80;
if (System.getenv("NEBULA_MONGODB_PORT") != null) {
port = Integer.parseInt(System.getenv("NEBULA_MONGODB_PORT"));
}
this.uri = "mongodb://" + System.getenv("NEBULA_MONGODB_HOST") + ":" + port;
}
return this.uri;
}
}
@Getter
public static class InternalMongoInfo {
public String address = "localhost";
public int port = 27017;
public String filePath = "database.mv";
public String filePath = "./data/database.mv";
}
@Getter
@@ -64,6 +75,10 @@ public class Config {
}
public String getPublicAddress() {
if (System.getenv("NEBULA_PUBLIC_HOST") != null) {
return System.getenv("NEBULA_PUBLIC_HOST");
}
if (this.publicAddress != null && !this.publicAddress.isEmpty()) {
return this.publicAddress;
}
@@ -72,6 +87,10 @@ public class Config {
}
public int getPublicPort() {
if (System.getenv("NEBULA_PUBLIC_PORT") != null) {
return Integer.parseInt(System.getenv("NEBULA_PUBLIC_PORT"));
}
if (this.publicPort != null && this.publicPort != 0) {
return this.publicPort;
}