Skip to content
This repository has been archived by the owner on Feb 11, 2020. It is now read-only.

allow persistence.factory in options to be string #171

Merged
merged 3 commits into from
Jul 11, 2014

Conversation

mocheng
Copy link
Contributor

@mocheng mocheng commented Jul 10, 2014

To fix #126

Should we allow factory to be either Function or String? or have a new option field type in persistence?

@mcollina
Copy link
Collaborator

Thanks! It should provide a better error reporting in case of an unknown
persistence. Plus, I think we should have them lowercased, just like
Ascoltatori.

@mocheng
Copy link
Contributor Author

mocheng commented Jul 10, 2014

If lowercased is allowed, I suppose it needs a map('redis' => mosca.persistence.Redis, 'mongo'=>mosca.persistence.Mongo, ...). Would that make maintenance more complex? I mean, every time a new persistence storage is added, the code about mapping should updated.

@mcollina
Copy link
Collaborator

We usually do not add persistences.

you can do that in a loop in the persistence file, extracting the previous keys with Object.keys() and iterating with a forEach.

@mocheng
Copy link
Contributor Author

mocheng commented Jul 10, 2014

That sounds cool. I'll update the PR.

mcollina added a commit that referenced this pull request Jul 11, 2014
allow persistence.factory in options to be string
@mcollina mcollina merged commit 40e9176 into moscajs:master Jul 11, 2014
@mocheng mocheng deleted the fix_126 branch July 12, 2014 01:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support configuring the persistence by passing 'type' as string.
2 participants