fix(ball-common): 提前对服务器 id 和 name 进行空判断
This commit is contained in:
@@ -46,7 +46,13 @@ public class BallServerInfo {
|
||||
public BallServerInfo(@NotNull ConfigSection config, @NotNull BallServerType type) {
|
||||
Map<String, String> env = System.getenv();
|
||||
id = env.getOrDefault("BALL_SERVER_ID", config.getString("id"));
|
||||
if (id == null || id.isEmpty()) {
|
||||
throw new IllegalArgumentException("id 不能为空");
|
||||
}
|
||||
name = env.getOrDefault("BALL_SERVER_NAME", config.getString("name"));
|
||||
if (name == null || name.isEmpty()) {
|
||||
throw new IllegalArgumentException("name 不能为空");
|
||||
}
|
||||
this.type = type;
|
||||
host = "0.0.0.0";
|
||||
port = 0;
|
||||
|
Reference in New Issue
Block a user