117503445 / GoWebDAV

a lightweight, easy-to-use WebDAV server
GNU General Public License v3.0
143 stars 28 forks source link

Config file #32

Closed Hunter23071985 closed 2 months ago

Hunter23071985 commented 5 months ago

Hello! Please add the ability to read settings from the config.ini/json/yaml file. For example:

host: 127.0.0.1
port: 82
path: D:\Test
auth:
  - user: user1
    pass: pass1
    rule: RWD
    sdir: .
  - user: user2
    pass: pass2
    rule: R
    sdir: /ADM

This will be convenient for a large number of WebDAV users! Thanks!

117503445 commented 5 months ago

What you said makes a lot of sense, I'll do it when I have time.

117503445 commented 2 months ago

In 1.10.0, I added support for config files. You can use configuration files through config.toml.

However, currently only the dav is supported. I will add auth which is more friendly to configuration files in subsequent updates.

The documentation will also be updated later.

spysir commented 2 months ago

In 1.10.0, I added support for config files. You can use configuration files through config.toml.在 1.10.0 中,我添加了对配置文件的支持。您可以通过 config.toml 使用配置文件。

However, currently only the dav is supported. I will add auth which is more friendly to configuration files in subsequent updates.但是,目前仅支持 dav。在后续更新中,我将添加 auth,这对配置文件更友好。

The documentation will also be updated later.文档也将在以后进行更新。

请问大佬,使用docker部署的话如何挂载配置文件?

117503445 commented 2 months ago

@Hunter23071985 see document at https://github.com/117503445/GoWebDAV/blob/master/doc/config.md

Hunter23071985 commented 2 months ago

According to the config description, the relationship between the user and the folders is one-to-many (a folder can have only one user, a user can have many folders). Please implement a many-to-many config (one folder can have many users with different rights). Thank you!

117503445 commented 2 months ago

You can adopt this approach: set different usernames and passwords for each DAV, and even the username can be root, as long as the passwords are different. If you want to allow a friend to access a particular DAV, you just need to send them the username and password for that DAV.

I am not very keen on adding a many-to-many mapping between users and DAVs. Here are my thoughts on the authentication and authorization functions.

This project is lightweight, written for individual users. My goal is for users to be able to complete configuration in a short amount of time. Many features are indeed useful in complex scenarios, but they increase the understanding and time costs for users in simple scenarios.

For example, in terms of authentication, OAuth2.0 is a more powerful method. However, I believe that HTTP Basic Auth is simple and convenient and already meets the needs of most users. Using a Google account to log into GoWebDAV would be overly complicated.

In terms of authorization, the finest granularity would be whether it is legal for a person to access a certain resource under a DAV using a specific method (GET or POST). However, there is no need to be so detailed; my approach is at the DAV granularity, focusing on passwords and methods for authorization.

If the relationship between users and DAVs were changed to many-to-many, then every time a DAV is added, it would be necessary to configure which users can access that DAV. I believe that in the context of GoWebDAV, such a design would actually be more troublesome.

Hunter23071985 commented 2 months ago

In this case, if I want to disable DAV for one of the people, I have to send a message to everyone else with a new login and password. This is very troublesome, I'd prefer to delete a couple of lines in config.toml. And I don't want to give everyone write permissions, for some (old people) it will be enough to allow reading.

Hunter23071985 commented 2 months ago

I've been waiting for config.toml for 76 days. And I'm ready to wait for the "many to many" scenario. But will it be implemented and how long will it take approximately?

117503445 commented 2 months ago

Temporarily, you can write the configuration file the way you like it, and then convert it to the now-supported configuration format via scripting

It should take a long time to officially add many-to-many features, as I want to remain cautious when introducing new features to prevent subsequent incompatible changes

117503445 commented 2 months ago

see #36