move embed logic to ocispkg
This commit is contained in:
@@ -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,
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user