GithubHelp home page GithubHelp logo

kamaln7 / mdmw Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 1.0 136 KB

a Markdown middleware HTTP server

License: MIT License

Go 97.76% Dockerfile 2.24%
golang markdown digitalocean digitalocean-spaces middleware http

mdmw's Introduction

mdmw logo

mdmw is a Markdown middleware HTTP server. It renders Markdown files and serves them back as HTML. It's not meant to be your sole www-facing webserver as it cannot serve non-markdown files.

You can use mdmw to host a micro-blog, quickly share documents, host documentation, etc.

mdmw supports two storage drivers (i.e. where it pulls markdown files from):

  • filesystem uses the OS filesystem to look up files
  • spaces uses DigitalOcean Spaces to look up files

mdmw exposes an HTTP server and uses the URI as the path for the markdown files.

Table of Contents generated with DocToc

installation

use the docker image RECOMMENDED

  1. pull the latest docker image
docker pull kamaln7/mdmw:latest

use a pre-built mdmw binary

  1. download a binary suitable for your OS from the releases page
  2. place said binary in /usr/local/bin or wherever you would like

usage

mdmw listens on localhost:4000 by default. Refer to the options section below for details on how to change that. If you are using the docker image, you will need to expose port 4000

See the options section below on how to configure mdmw. You can run docker run -p 4000 kamaln7/mdmw (use -e or --env-file to pass configuration options) or run mdmw directly if you chose to not use Docker.

options

Usage:
  mdmw [flags]

Flags:
      --config string               config file (default is ./.mdmw.yaml)
      --filesystem.path string      path to markdown files (default "./files")
  -h, --help                        help for mdmw
      --listenaddress string        address to listen on (default "localhost:4000")
      --outputtemplate string       path to HTML output template
      --spaces.auth.access string   DigitalOcean Spaces access key
      --spaces.auth.secret string   DigitalOcean Spaces secret key
      --spaces.cache string         DigitalOcean Spaces cache time (default "0")
      --spaces.path string          DigitalOcean Spaces files path (default "/")
      --spaces.region string        DigitalOcean Spaces region
      --spaces.space string         DigitalOcean Spaces space name
      --storage string              storage driver to use (default "filesystem")
      --validateextension           validate that files have a markdown extension (default true)

There are three ways to configure mdmw. examples for each can be found below

  1. use a config file (yaml, toml, json, etc.) and pass -config ./path/to/config
    • options become nested objects, see the example below
  2. pass cli flags as described above
  3. use environment variables
    • options become uppercase with periods replaced by underscores, see the example below

configuration examples

  • listen on 0.0.0.0:8080
  • serve files from a Space in AMS3
as a yaml config file
listenaddress: 0.0.0.0:8080
storage: spaces
spaces:
  auth:
    access: ACCESS KEY GOES HERE
    secret: SECRET KEY GOES HERE
  region: ams3
  space: SPACE NAME GOES HERE
as cli flags
mdmw \
  --listenaddress 0.0.0.0:8000 \
  --storage spaces \
  --spaces.auth.access "ACCESS KEY GOES HERE" \
  --spaces.auth.secret "SECRET KEY GOES HERE" \
  --spaces.region ams3 \
  --spaces.space "SPACE NAME GOES HERE"
as environment variables
LISTENADDRESS=0.0.0.0:8000 \
STORAGE=spaces \
SPACES_AUTH_ACCESS=ACCESS KEY GOES HERE \
SPACES_AUTH_SECRET=SECRET KEY GOES HERE \
SPACES_REGION=ams3 \
SPACES_SPACE=SPACE NAME GOES HERE \
mdmw

license

MIT. see LICENSE

mdmw's People

Contributors

kamaln7 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

priestd09

mdmw's Issues

Block spaces file listing

Right now, a request to e.g. / with the spaces storage driver and validateextension=false returns a file listing. Need to validate that we are receiving an actual file from Spaces before parsing

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.