mirror of
https://github.com/octoleo/restic.git
synced 2024-11-30 00:33:57 +00:00
server: Test for existing config
This commit is contained in:
parent
ddc44ddfb1
commit
991a325cc5
@ -579,6 +579,14 @@ func (s *Server) SearchKey(password string) error {
|
|||||||
// CreateMasterKey creates a new key with the supplied password, afterwards the
|
// CreateMasterKey creates a new key with the supplied password, afterwards the
|
||||||
// repository config is created.
|
// repository config is created.
|
||||||
func (s *Server) CreateMasterKey(password string) error {
|
func (s *Server) CreateMasterKey(password string) error {
|
||||||
|
has, err := s.Test(backend.Config, "")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if has {
|
||||||
|
return errors.New("repository master key and config already initialized")
|
||||||
|
}
|
||||||
|
|
||||||
key, err := createMasterKey(s, password)
|
key, err := createMasterKey(s, password)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
Loading…
Reference in New Issue
Block a user