We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 9978ba8 + 614f789 commit dbdc442Copy full SHA for dbdc442
src/adapter.ts
@@ -31,16 +31,13 @@ export default class TypeORMAdapter implements Adapter {
31
* @param option typeorm connection option
32
*/
33
public static async newAdapter(option: ConnectionOptions) {
34
- const officialOption = {
35
- entities: [CasbinRule],
+ const defaults = {
36
synchronize: true,
37
name: 'node-casbin-official'
38
};
39
- if (option.name) {
40
- officialOption.name = option.name;
41
- }
42
-
43
- const a = new TypeORMAdapter(Object.assign(option, officialOption));
+ const entities = { entities: [CasbinRule] };
+ const configuration = Object.assign(defaults, option);
+ const a = new TypeORMAdapter(Object.assign(configuration, entities));
44
await a.open();
45
return a;
46
}
0 commit comments