diff --git a/gradle.properties b/gradle.properties
index 791e9a4..ad8c396 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,6 +1,6 @@
## Core
-VERSION = 0.7.0.5
+VERSION = 0.7.0.6
# dependencies
diff --git a/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java b/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java
index ad433d0..c4542ff 100644
--- a/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java
+++ b/src/main/java/cc/sukazyo/cono/morny/GradleProjectConfigures.java
@@ -4,6 +4,6 @@ package cc.sukazyo.cono.morny;
* the final field that will be updated by gradle automatically.
*/
public class GradleProjectConfigures {
- public static final String VERSION = "0.7.0.5";
- public static final long COMPILE_TIMESTAMP = 1652944218716L;
+ public static final String VERSION = "0.7.0.6";
+ public static final long COMPILE_TIMESTAMP = 1652946142762L;
}
diff --git a/src/main/java/cc/sukazyo/cono/morny/ServerMain.java b/src/main/java/cc/sukazyo/cono/morny/ServerMain.java
index b7d9d78..b434bc7 100644
--- a/src/main/java/cc/sukazyo/cono/morny/ServerMain.java
+++ b/src/main/java/cc/sukazyo/cono/morny/ServerMain.java
@@ -15,10 +15,8 @@ import static cc.sukazyo.cono.morny.Log.logger;
*/
public class ServerMain {
- private static boolean versionEchoMode = false;
- private static boolean welcomeEchoMode = false;
-
- private static boolean showWelcome = true;
+ public static final String PROP_TOKEN_KEY = "TELEGRAM_BOT_API_TOKEN";
+ public static final String PROP_TOKEN_MORNY_KEY = "MORNY_TG_TOKEN";
/**
* 程序入口,也是参数处理器
@@ -71,6 +69,13 @@ public class ServerMain {
*/
public static void main (@Nonnull String[] args) {
+ //#
+ //# 启动参数设置区块
+ //#
+
+ boolean versionEchoMode = false;
+ boolean welcomeEchoMode = false;
+ boolean showWelcome = true;
String key = null;
String username = null;
boolean outdatedBlock = false;
@@ -136,6 +141,19 @@ public class ServerMain {
}
+ String propToken = null;
+ String propTokenKey = null;
+ for (String iKey : new String[]{PROP_TOKEN_KEY, PROP_TOKEN_MORNY_KEY}) {
+ if (System.getenv(iKey) != null) {
+ propToken = System.getenv(iKey);
+ propTokenKey = iKey;
+ }
+ }
+
+ //#
+ //# 启动相关参数的检查和处理
+ //#
+
if (versionEchoMode) {
logger.info(String.format("""
@@ -159,6 +177,14 @@ public class ServerMain {
if (showWelcome) logger.info(MornyHello.MORNY_PREVIEW_IMAGE_ASCII);
if (welcomeEchoMode) return;
+ //#
+ //# Coeur 参数检查和正式启动主程序
+ //#
+
+ if (propToken != null) {
+ key = propToken;
+ logger.info("Parameter set by EnvVar $"+propTokenKey);
+ }
if (key == null) {
logger.info("Parameter required has no value:\n --token.");
return;