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

Psql #2506

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open

Psql #2506

wants to merge 17 commits into from

Conversation

pkuwwt
Copy link

@pkuwwt pkuwwt commented Jun 17, 2023

Description
Add sql support in addition to bolt, including sqlite3, postgres, mysql.

Most code are in storage/sql, except a few lines in cmd/root.go and cmd/utils.go.

Usage

filebrowser -d sqlite3://test.db
filebrowser -d 'postgres://user:password@192.168.1.100:5432/postgres?sslmode=disable'

Reason
Bolt is a relative non-mainstream choice for storage. When someone use filebrowser as a component of a project, he/she will need a centralized storage server, e.g. postgres, mysql, other than bolt.

@pkuwwt pkuwwt requested a review from o1egl as a code owner June 17, 2023 14:02
@github-actions
Copy link

This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Jul 18, 2023
@o1egl o1egl added wip Work in progress and removed Stale labels Jul 22, 2023
@o1egl o1egl force-pushed the master branch 2 times, most recently from 813c2e9 to 66dfbb3 Compare July 28, 2023 22:27
@pkuwwt
Copy link
Author

pkuwwt commented Dec 21, 2023

conflicts resolved @o1egl

@sevmonster
Copy link

sevmonster commented Feb 6, 2024

Can any effort be put into merging this? Filebrowser CLI cannot be used inside container or while it's running in general, because of the exclusive database lock. This is seriously inconvenient. I am forced at this point to either kill filebrowser every time I want to run a CLI command, or build this PR for use in production. This also affects automation and makes it difficult to programmatically add users (for example) based on other input. I would use the API but it is not documented and seems fiddly to use, #2551.

@sevmonster
Copy link

sevmonster commented Feb 7, 2024

I built this and merged with master. Works with Postgres, but I've found some issues.

  1. The github.com/mattn/go-sqlite3 library isn't being updated anymore, and the last release is from 2022. It didn't build successfully on my machine, and I had to update it to the latest Git commit v0.0.0-20240202170028-6ee3e6746e6b to build.
  2. AuthMethod of type proxy does not seem to work. It either isn't grabbing the header from the auther row, or is not being properly substituted in the SQL statement. I am investigating.
    The statement being run:
    SELECT id,username,password,scope,locale,lockpassword,viewmode,perm,commands,sorting,rules,hidedotfiles,dateformat,singleclick FROM "fb_users" WHERE username=''
    As a consequence of this, I see the login page since it is shown when the user either doesn't exist or isn't authed properly, as noted in many other issues.
    Actually, this seems to be an upstream bug. Proxy auth doesn't work #2995
  3. config set attempts to insert already existing rows, like Root and Socket. I had to delete all the offending rows to allow it to re-insert them in order to use the command and add new values.

@pkuwwt
Copy link
Author

pkuwwt commented Feb 9, 2024

@sevmonster config set problem solved by insert-or-update

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

Successfully merging this pull request may close these issues.

None yet

3 participants