Load the node server settings from a .env file
The reflector and probe node read .env next to the binary and from the working directory. Command-line flags still override environment variables, which override the file. Missing .env files are ignored, and the packaged defaults stay TCP 19090 and UDP 19091. Co-authored-by: yanjiu0721 <yanjiu0721@users.noreply.github.com>
This commit is contained in:
1 parent
f6ffbde518
commit
ef1c5b42ab
14 files changed
+1086
-106
No files matched your search
@@ -5,7 +5,12 @@ Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/local/bin/netquality-reflector -mode both -bind 0.0.0.0 -tcp-port 19090 -udp-port 19091 -control-addr 127.0.0.1:8443
|
||||
# 端口和口令写在 /opt/netquality/.env。
|
||||
# 这份服务通过环境变量把模式固定成 both(反射 + 节点),会盖过 .env 里的 NQ_MODE。
|
||||
# 节点口令请改 .env 的 NQ_NODE_TOKEN,不要把真实口令写进本文件。
|
||||
WorkingDirectory=/opt/netquality
|
||||
Environment=NQ_MODE=both
|
||||
ExecStart=/opt/netquality/netquality-reflector
|
||||
Restart=on-failure
|
||||
RestartSec=2
|
||||
NoNewPrivileges=true
|
||||
@@ -13,11 +18,5 @@ ProtectSystem=strict
|
||||
ProtectHome=true
|
||||
PrivateTmp=true
|
||||
|
||||
# 二选一,不要把真实口令提交到仓库。
|
||||
# 留空或不设置 NQ_NODE_TOKEN:公开节点,任何人都能用,但有并发和时长上限。
|
||||
# Environment=NQ_NODE_TOKEN=replace-with-your-own-node-token
|
||||
# 下面这个是反射帧里的回显口令,和节点口令不是同一个。
|
||||
# Environment=NQ_TOKEN=replace-with-your-own-echo-token
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -5,7 +5,10 @@ Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/usr/local/bin/netquality-reflector -bind 0.0.0.0 -tcp-port 19090 -udp-port 19091
|
||||
# 端口、回显口令和模式写在 /opt/netquality/.env。
|
||||
# 默认 NQ_MODE=reflector,只做反射。改完 .env 后执行 systemctl restart。
|
||||
WorkingDirectory=/opt/netquality
|
||||
ExecStart=/opt/netquality/netquality-reflector
|
||||
Restart=on-failure
|
||||
RestartSec=2
|
||||
NoNewPrivileges=true
|
||||
@@ -13,8 +16,5 @@ ProtectSystem=strict
|
||||
ProtectHome=true
|
||||
PrivateTmp=true
|
||||
|
||||
# Optional shared token. Uncomment and set a short passphrase (max 32 bytes).
|
||||
# Environment=NQ_TOKEN=replace-me
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -0,0 +1,19 @@
|
||||
[Unit]
|
||||
Description=网络质量探测节点
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
# 程序和 .env 放在同一目录。端口、口令、模式都改 .env,不要改这一行。
|
||||
WorkingDirectory=/opt/netquality
|
||||
ExecStart=/opt/netquality/netquality-reflector
|
||||
Restart=on-failure
|
||||
RestartSec=2
|
||||
NoNewPrivileges=true
|
||||
ProtectSystem=strict
|
||||
ProtectHome=true
|
||||
PrivateTmp=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in new issue
Block a user