esetres
A single install self hosted file storage server.
Get Started
Install
# check version to verify installation
Run Init
Run the init command and go through the setup process.
Start the server
[!TIP] See our examples to see how to host and structure your server.
API
[!NOTE] Clients may be added in the future
Health Check GET/health
Returns a simple running status for the server.
Create bucket POST/buckets (authed)
Creates a new bucket.
Request Body:
Invalidate Cache POST/cache/invalidate
This is configured for local only access. It will invalidate the token cache causing a refetch from the database. This will be hit when you mint or revoke tokens.
Get File GET/buckets/{bucket}/{public | private}/{file_name}
Gets the requested file from the requested bucket. Requests to private must be authorized.
Upload File PUT/buckets/{bucket}/{public | private}/{file_name} (authed)
Uploads the file to the requested bucket with the requested file name.
Request Body: File Content In Bytes
Delete File DELETE/buckets/{bucket}/{public | private}/{file_name} (authed)
Deletes the file with the requested bucket and file name.
CLI
[!WARNING] All commands must be run from the same directory as the server.
Init
Step by step process for setting up the environment variables, running the migration and creating your first bucket.
|
|
|
|
|
TOKEN_SECRET="[hidden]"
IP="172.31.144.1"
PORT="8080"
HTTPS=0
|
|
|
|
|
|
|
Start
Starts the server.
Run Migration
esetres uses a local sqlite database to store the tokens. In the init function you can choose to run this automatically or you can run it yourself at any time with:
Buckets
You can create buckets from the api or by creating the folders yourself on the server. However the CLI enables some extra functionality.
Create
Creates a new bucket and the required folders.
Delete
Deletes the bucket and all contents.
List
Lists all the buckets and their last modified time.
|
|
Tokens
Tokens allow you to control access to the server. It uses jwt with the Bearer scheme meaning authorized routes require the authorization header.
Tokens are cached by the server for fast responses and when you create or delete tokens the cache will automatically be updated.
Mint
Creates a new token with specified scope and access.
Create
) )
Set Scope
Scope allows you to limit the buckets a token has access to.
# default scope is "*"
Set Access
Access allows you to limit the permissions a token has to create buckets, upload files, and read files.
# default access is "read"
List
Lists all existing tokens with the most recently created being at the top.
| |
| |
| |
Revoke
Deletes a token from the database.
Mime Types
The mime types come from mime-db. When you first start the server it will grab the types from the db and store it on machine. You can always delete the mime-db.json file to refresh it.