Esempio n. 1
0
// New returns a new Service.
func New(cfg *config.Config) (services.Service, error) {
	dirs := cfg.GetDirectives()
	authenticator := lib.NewAuthenticator(dirs.Server.JWTSecret, dirs.Server.JWTSigningMethod)

	dataController, err := data.GetDataController(cfg)
	if err != nil {
		return nil, err
	}

	authenticationController, err := authentication.GetAuthenticationController(cfg)
	if err != nil {
		return nil, err
	}

	metaDataController, err := metadata.GetMetaDataController(cfg)
	if err != nil {
		return nil, err
	}

	if err := os.MkdirAll(dirs.OCWebDAV.ChunksNamespace, 0755); err != nil {
		return nil, err
	}

	if err := os.MkdirAll(dirs.OCWebDAV.ChunksTemporaryNamespace, 0755); err != nil {
		return nil, err
	}

	return &svc{conf: cfg, authenticator: authenticator, dataController: dataController, metaDataController: metaDataController, authenticationController: authenticationController}, nil
}
Esempio n. 2
0
// New returns a new Service.
func New(cfg *config.Config) (services.Service, error) {
	dirs := cfg.GetDirectives()
	authenticator := lib.NewAuthenticator(dirs.Server.JWTSecret, dirs.Server.JWTSigningMethod)

	dataController, err := data.GetDataController(cfg)
	if err != nil {
		return nil, err
	}

	authenticationController, err := authentication.GetAuthenticationController(cfg)
	if err != nil {
		return nil, err
	}

	metaDataController, err := metadata.GetMetaDataController(cfg)
	if err != nil {
		return nil, err
	}

	return &svc{conf: cfg, authenticator: authenticator, dataController: dataController, metaDataController: metaDataController, authenticationController: authenticationController}, nil
}