http-fs

command module
v0.0.0-...-0c19f2e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

README

infinimesh HTTP FileServer

Build Docker Images

Simple HTTP FileServer made for infimesh, but can be extended and applied for other services with simillar purposes.

Right now only FileSystem storage is supported.

General logic

Server understands two things:

  • namespaces (folders)
  • files (well, just files)

So these are routes:

GET /{ns} - returns stats (files and their props) in the requested namespace DELETE /{ns} - deletes namespace(and its files) GET /{ns}/{file} - returns file itself POST /{ns}/{file} - uploads file DELETE /{ns}/{file} - deletes file

See the Postman Collection to try it yourself.

Installation

Docker(compose) service example:

    http-fs:
        image: ghcr.io/infinimesh/http-fs:latest
        restart: always
        ports:
            - "80:8000"
        environment:
            ADDR: :8000
            REPO: repo:8000
            STATIC_DIR: /static # you should probably map this to some real volume
            UPLOAD_LIMIT: 10485760 # 10MB
            LOG_LEVEL: -1 # -1 for debug, 0 for info, 1 for warning, 2 for error (defaults to info)

Default logic

Namespaces are mapped to:

  1. infinimesh namespaces - middleware determines access to the folder basing on the user's permissions
  2. filesystem directory

These is the result of using InfinimeshMiddleware and FileSystem IOHandler

How to extend

Middleware

Middleware is a mux middleware which adds Access to context.

Access defined here. It's a simple structure which defined if requestor has Read and Write access to the namespace/file.

You can also see the SampleMiddleware to (maybe) get a better idea.

IOHandler

IOHandler is an interface which has few methods decribed here

Building

Replace used middlewares and IOHandler with your own and compile.

Documentation

Overview

Copyright © 2021-2022 Infinite Devices GmbH

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Directories

Path Synopsis
pkg
io
mw

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL