Merge pull request #54 from kaermorchen/auth-from-config
Add default auth from config settings
This commit is contained in:
commit
bd7f85d7de
2 changed files with 24 additions and 0 deletions
20
app/session-stores/application.js
Normal file
20
app/session-stores/application.js
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import EphemeralStore from 'ember-simple-auth/session-stores/ephemeral';
|
||||
import LocalStorageStore from 'ember-simple-auth/session-stores/local-storage';
|
||||
import config from 'meiliadmin/config/environment';
|
||||
|
||||
const settings = config?.APP?.meilisearch;
|
||||
|
||||
class ConfigStore extends EphemeralStore {
|
||||
restore() {
|
||||
const result = {
|
||||
authenticated: Object.assign(
|
||||
{ authenticator: 'authenticator:meilisearch' },
|
||||
settings
|
||||
),
|
||||
};
|
||||
|
||||
return Promise.resolve(result);
|
||||
}
|
||||
}
|
||||
|
||||
export default settings ? ConfigStore : LocalStorageStore;
|
||||
|
|
@ -16,6 +16,10 @@ module.exports = function (environment) {
|
|||
APP: {
|
||||
// Here you can pass flags/options to your application instance
|
||||
// when it is created
|
||||
// meilisearch: {
|
||||
// url: 'http://localhost:7700',
|
||||
// key: 'MASTER_KEY',
|
||||
// },
|
||||
},
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue