更新环境变量
This commit is contained in:
@@ -10,7 +10,6 @@ import './controller/AreaController.dart';
|
||||
|
||||
import 'const/ServiceConstant.dart';
|
||||
|
||||
|
||||
import './const/CommonVariables.dart';
|
||||
|
||||
void main(List<String> args) async {
|
||||
@@ -21,14 +20,34 @@ Future<void> initEasyDartModule() async {
|
||||
try {
|
||||
String? web = Platform.environment["web_port"] ?? "9200";
|
||||
List<String> redis =
|
||||
(Platform.environment["redis"] ?? "127.0.0.1:6379").split(":");
|
||||
if (redis.length == 1) {
|
||||
redis.add("6379");
|
||||
(Platform.environment["redis"] ?? "default@localhost:6379/0")
|
||||
.split(":");
|
||||
String host;
|
||||
int port = 6379;
|
||||
String? password;
|
||||
int db = 0;
|
||||
var hs = redis[0].split("@");
|
||||
if (hs.length == 2) {
|
||||
host = hs[1];
|
||||
if (hs[0] != "default") {
|
||||
password = hs[0];
|
||||
}
|
||||
} else {
|
||||
host = hs[0];
|
||||
}
|
||||
var pd = redis[1].split("/");
|
||||
if (pd.length == 2) {
|
||||
db = int.parse(pd[1]);
|
||||
port = int.parse(pd[0]);
|
||||
} else {
|
||||
port = int.parse(pd[0]);
|
||||
}
|
||||
|
||||
EasyDartModule.init(
|
||||
loggerConfig: LoggerConfig(
|
||||
host: ServiceConstant.logService, serviceName: "快检报告服务"),
|
||||
redisConfig: RedisConfig(host: redis[0], port: int.parse(redis[1])),
|
||||
redisConfig: RedisConfig(
|
||||
host: host, port: port, database: db, password: password),
|
||||
webSocketConfig:
|
||||
WebSocketConfig(ServiceConstant.webSocketService, (data) {
|
||||
// 接收到服务消息
|
||||
|
||||
Reference in New Issue
Block a user