Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] onebot.accountonebot.password 无法作为环境变量的标识符 #117

Closed
shniubobo opened this issue Nov 29, 2020 · 1 comment

Comments

@shniubobo
Copy link

$ sh -c "export onebot.account=1"
sh: 1: export: onebot.account: bad variable name

$ bash -c "export onebot.account=1"
bash: line 0: export: `onebot.account=1': not a valid identifier

$ zsh -c "export onebot.account=1"
zsh:export:1: not valid in this context: onebot.account

复现

见上方控制台报错。

版本

与版本无关,点不能出现在环境变量的名字里。

如果一定需要 . 的话也不是不可以,但不能用 export。一个可用的 workaround:

$ env onebot.account=1 python3 -c "import os; print(os.environ['onebot.account'])"
1

(这里用 python3 只是为了演示这个环境变量被成功设置了)

@yyuueexxiinngg
Copy link
Owner

这个是当时为了和mirai-console 0.5.2的property风格一致这么写的, 将在下个Release改为

  • ONEBOT_ACCOUNT
  • ONEBOT_PASSWORD
  • ONEBOT_BACKEND

另外对于Windows上的PowerShell用户, 目前要设置带点的环境变量要这样 ${env:onebot.account} = "123456"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants