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

Feature:为非桌面环境提供修改部分 koishi.yml 的功能 #100

Open
Lipraty opened this issue Feb 9, 2023 · 10 comments
Open

Feature:为非桌面环境提供修改部分 koishi.yml 的功能 #100

Lipraty opened this issue Feb 9, 2023 · 10 comments

Comments

@Lipraty
Copy link
Member

Lipraty commented Feb 9, 2023

来自: koishijs/koishi#970

为非桌面环境用户提供例如 koi default --config host 0.0.0.0 的命令来修改实例 default 的 host0.0.0.0

@MaikoTan
Copy link
Member

MaikoTan commented Feb 9, 2023

I am assuming you're talking about linux server. Sorry if the answer beyonds that.

I think you could always use other cli tools to achieve this like:

sed 's/^host:.*$/host: 0.0.0.0/' koishi.yml

Not to mention there are vi or nano that you could use as an editor.

@ilharp
Copy link
Member

ilharp commented Feb 9, 2023

的确有在考虑通过类似 koi edit default 的方式拉起编辑器进行编辑,或使用 koi patch default -p '{"host": "0.0.0.0"}' 的方式完成更改。如果后期该需求较大,我们还可以添加 koi expose default 作为上面命令的别名。

不过更改完成后应该直接重启对应实例吗?Koishi 目前似乎没有方法程序性地触发热重载或冷重载。

@MaikoTan
Copy link
Member

I think if you instint to add a command like above, would it be better to be an option like koi start -n default --listen?
In my opinion, koi edit or koi config are too board for just a small set for the configuration file.

@shigma
Copy link
Member

shigma commented Feb 10, 2023

所以要不要增加一个环境变量之类,默认值改成 process.env.KOISHI_HOST || '127.0.0.1'

@Lipraty
Copy link
Member Author

Lipraty commented Feb 10, 2023

这个好诶(


Generated by koishi-plugin-github.

@medicago087
Copy link

这个好诶(


Generated by koishi-plugin-github.

@ilharp
Copy link
Member

ilharp commented Feb 10, 2023

使用 --listen 设置 KOISHI_HOST 是可行的,但这是否意味着用户每次启动实例都需要附加 --listen?对于 koishijs/koishi#970 的需求来说这可能比上述修改配置文件的方案更麻烦。

此外我也不希望 Koishi 为 Koishi Desktop 做出任何额外的更改,KOISHI_HOST 会导致该功能实际需要 boilerplate 的修改。

@shigma
Copy link
Member

shigma commented Feb 10, 2023

此外我也不希望 Koishi 为 Koishi Desktop 做出任何额外的更改,KOISHI_HOST 会导致该功能实际需要 boilerplate 的修改

不,我的意思是直接改 satori 源码,将默认值变成 process.env.KOISHI_HOST || '127.0.0.1'

但诚然我不认为这是一个很好的改法,因为会让网页中的配置失去一定的直观性。默认值如果是易变的,可能会引起用户的疑惑。

@ilharp
Copy link
Member

ilharp commented Feb 10, 2023

是的。并且我坚持 这里 的看法,我认为 expose 应该是一个一次性的操作,因为没有场景会需要单次、临时的 expose。expose 应当通过直接修改配置文件的方式实现。

用户可以通过三种方式中的任一种实现 expose:

  • koi edit default 后修改 host
  • koi patch default -p '{"host": "0.0.0.0"}'
  • koi expose default

之后,使用 koi start default 启动实例。

Koishi 侧无需也不应对此需求进行代码层面的修改。

@MaikoTan
Copy link
Member

The issue in koishijs/koishi#970 is even not using desktop but docker, the user is a bt user so he cannot easily touch the configuration files when he didn't mount the volume.
Also this is the issue I still have no idea how could it happen, since we have already changed the host to 0.0.0.0 in the Dockerfile.

I think if you're using desktop, you're 99.99% in a GUI, which has at least a valid browser for you to change the ip. As for linux desktop user, I really don't think this is an issue.

To be clear, I am not saying that the koi edit command is bad, but this command didn't actually fix issues, also make user faulty possibly, like adding an extra comma makes Koishi never live again.

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

5 participants