mashlol / notify

Notify your devices from the terminal

Home Page:https://mashlol.github.io/notify/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Change key storage format

taylorjdawson opened this issue · comments

Issues/Features #36, #31, #35 all hinge on the storage schema of the keys. I am not sure if the current schema would work best with the previously mentioned features.

I like YAML. It is human readable and allows for simple access implementation. It would require an additional module. Also if in the future one wanted to create a 'group' to notify then YAML would facilitate this nicely (see here).

Here is the yaml schema that I propose:

keys:
  asdf: android
  qwer: null
aliases:
  android: asdf

Separating keys and aliases simplifies CRUD operations.

I like this structure - but I'd love for it to be backward compatible. Perhaps we could read the old txt format first, see if it matches and if so convert over to the yaml format, whenever a key is registered?

Another option, to keep it lightweight, we could just adjust the existing format a bit:

key:alias1,alias2
key2:alias3,alias4

Search time is probably not really a factor in the format, since it's unlikely for anyone to have many aliases/keys

Okay! I had already started working on the yaml schema but I can change it back if need be. What do you think about this implementation?

Yeah looking good! The only thing I don't like that much is that we're writing in a get method, so it has a side effect that may be unexpected. Perhaps simply changing the name to getYamlRegFileOrMigrate or something would be enough to solve that problem.

@mashlol okay will do!