Overlay file system
Go to file
jolheiser a43841c5ba
continuous-integration/drone/pr Build is passing Details
overlay has no build
Signed-off-by: jolheiser <john.olheiser@gmail.com>
2021-05-08 23:01:09 -05:00
_test Initial Commit 2021-02-16 22:57:59 -06:00
.drone.yml overlay has no build 2021-05-08 23:01:09 -05:00
.gitignore Initial Commit 2021-02-16 22:57:59 -06:00
LICENSE Initial Commit 2021-02-16 22:57:59 -06:00
Makefile Initial Commit 2021-02-16 22:57:59 -06:00
README.md Add build tag to README 2021-05-08 22:56:28 -05:00
bench.txt Rebrand overlay 2021-02-17 22:39:52 -06:00
go.mod Rebrand overlay 2021-02-17 22:39:52 -06:00
overlay.go Add ReadFile, interface guard, and drone CI 2021-05-08 22:54:36 -05:00
overlay_test.go Add ReadFile, interface guard, and drone CI 2021-05-08 22:54:36 -05:00

README.md

Overlay

Build Status

Overlay File System

Overlay is an easy way to implement a file system in such a way that production assets can be overridden by assets on disk.

Usage

package main

import (
	"embed"
	
	"go.jolheiser.com/overlay"
)

//go:embed assets
var assets embed.FS

func main() {
	ofs, err := overlay.New("/var/lib/myapp/custom", assets)
	if err != nil {
		panic(err)
    }
    ...
}

If /var/lib/myapp/custom has an assets sub-directory, this implementation works.

However, if /var/lib/myapp/custom matches the assets directory layout, you can use WithSub like so...

package main

import (
	"embed"
	
	"go.jolheiser.com/overlay"
)

//go:embed assets
var assets embed.FS

func main() {
	ofs, err := overlay.New("/var/lib/myapp/custom", assets, overlay.WithSub("assets"))
	if err != nil {
		panic(err)
    }
    ...
}

License

MIT