feat: init api
This commit is contained in:
@@ -35,12 +35,14 @@ type Param struct {
|
||||
StoragePath string
|
||||
}
|
||||
|
||||
func NewController(configure func(*Param)) (*Controller, error) {
|
||||
type Config func(*Param)
|
||||
|
||||
func NewController(config Config) (*Controller, error) {
|
||||
c := &Param{
|
||||
StoragePath: ".",
|
||||
}
|
||||
if configure != nil {
|
||||
configure(c)
|
||||
if config != nil {
|
||||
config(c)
|
||||
}
|
||||
r, err := repo.NewFileRepo(c.StoragePath)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user