// Init reads the records from disk from a given path func Init(path, hcKey, hcRoom, hcHost, roHost string) error { var err error defer func() { if err != nil { log.Printf("core.init failed: %v", err) } else { log.Printf("core.init success: path=%s", path) } }() if records, err = passvault.InitFrom(path); err != nil { err = fmt.Errorf("failed to load password vault %s: %s", path, err) } var hipchatClient hipchat.HipchatClient if hcKey != "" && hcRoom != "" && hcHost != "" { roomId, err := strconv.Atoi(hcRoom) if err != nil { return errors.New("core.init unable to use hipchat roomId provided") } hipchatClient = hipchat.HipchatClient{ ApiKey: hcKey, RoomId: roomId, HcHost: hcHost, RoHost: roHost, } } orders = order.NewOrderer(hipchatClient) cache = keycache.Cache{UserKeys: make(map[keycache.DelegateIndex]keycache.ActiveUser)} crypt = cryptor.New(&records, &cache) return err }
// Init reads the records from disk from a given path func Init(path string) (err error) { if records, err = passvault.InitFrom(path); err != nil { err = fmt.Errorf("Failed to load password vault %s: %s", path, err) } cache = keycache.Cache{UserKeys: make(map[string]keycache.ActiveUser)} crypt = cryptor.New(&records, &cache) return }
// Init reads the records from disk from a given path func Init(path string) error { var err error defer func() { if err != nil { log.Printf("core.init failed: %v", err) } else { log.Printf("core.init success: path=%s", path) } }() if records, err = passvault.InitFrom(path); err != nil { err = fmt.Errorf("failed to load password vault %s: %s", path, err) } cache = keycache.Cache{UserKeys: make(map[keycache.DelegateIndex]keycache.ActiveUser)} crypt = cryptor.New(&records, &cache) return err }