move embed logic to ocispkg

This commit is contained in:
jkoberg
2021-10-18 13:01:17 +02:00
parent d2026a5d94
commit 88664152e3
16 changed files with 125 additions and 323 deletions
-29
View File
@@ -1,29 +0,0 @@
package assets
import (
graph_explorer "github.com/owncloud/ocis/graph-explorer"
"github.com/owncloud/ocis/graph-explorer/pkg/config"
"github.com/owncloud/ocis/ocis-pkg/log"
"net/http"
)
// assets gets initialized by New and provides the handler.
type assets struct {
logger log.Logger
config *config.Config
}
// Open just implements the HTTP filesystem interface.
func (a assets) Open(original string) (http.File, error) {
return graph_explorer.Assets.Open(original)
}
// New returns a new http filesystem to serve assets.
func New(opts ...Option) http.FileSystem {
options := newOptions(opts...)
return assets{
logger: options.Logger,
config: options.Config,
}
}
+10
View File
@@ -1,10 +1,20 @@
package assets
import (
"net/http"
graphexplorer "github.com/owncloud/ocis/graph-explorer"
"github.com/owncloud/ocis/graph-explorer/pkg/config"
"github.com/owncloud/ocis/ocis-pkg/assetsfs"
"github.com/owncloud/ocis/ocis-pkg/log"
)
// New returns a new http filesystem to serve assets.
func New(opts ...Option) http.FileSystem {
options := newOptions(opts...)
return assetsfs.New(graphexplorer.Assets, "", options.Logger)
}
// Option defines a single option function.
type Option func(o *Options)