file-server

command module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: MIT Imports: 7 Imported by: 0

README

File Server

A simple Go program to serve files, with some bonus features 😎

NOTE: Only tested on Linux

Key points

  • Serves all static files from a root folder
  • Has a GET /api/random endpoint which returns the path to a file with whitelisted file extension
  • Watches the filesystem to keep track of all currently existing files (no restart needed when new files/folders are added or old removed)

Running

Required environment variables:

  • FILE_SERVER_ROOT_FOLDER: A path to the folder containing files
  • FILE_SERVER_HOST: The host where the server is running (will typically be http://localhost, or a domain: https://example.com)

Optional environment variables:

  • FILE_SERVER_WHITELISTED_EXTENSIONS: A comma separated list to set custom file types to be considered valid. Defaults to jpeg,jpg,png,gif,mp4,mp3,wav,avi,mkv,mov,webm
  • PORT: Set the port the server will be running on. Defaults to 8000
  • LOG_LEVEL: Set the desired log level, only debug and info are currently supported. Defaults to info

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
v1

Jump to

Keyboard shortcuts

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