Fix `TokenSecretID`-handling
This commit is contained in:
parent
12a923c658
commit
955949998f
|
@ -16,23 +16,26 @@ export default class ApplicationRoute extends Route.extend(WithBlockingActions)
|
||||||
async model() {
|
async model() {
|
||||||
if (this.env.var('CONSUL_ACLS_ENABLED')) {
|
if (this.env.var('CONSUL_ACLS_ENABLED')) {
|
||||||
const secret = this.env.var('CONSUL_HTTP_TOKEN');
|
const secret = this.env.var('CONSUL_HTTP_TOKEN');
|
||||||
const existing = await this.settings.findBySlug('token');
|
if (secret) {
|
||||||
if (!existing.AccessorID && secret) {
|
const existing = await this.settings.findBySlug('token');
|
||||||
try {
|
|
||||||
const token = await this.tokenRepo.self({
|
if (secret && secret !== existing.SecretID) {
|
||||||
secret: secret,
|
try {
|
||||||
dc: this.env.var('CONSUL_DATACENTER_LOCAL'),
|
const token = await this.tokenRepo.self({
|
||||||
});
|
secret: secret,
|
||||||
await this.settings.persist({
|
dc: this.env.var('CONSUL_DATACENTER_LOCAL'),
|
||||||
token: {
|
});
|
||||||
AccessorID: token.AccessorID,
|
await this.settings.persist({
|
||||||
SecretID: token.SecretID,
|
token: {
|
||||||
Namespace: token.Namespace,
|
AccessorID: token.AccessorID,
|
||||||
Partition: token.Partition,
|
SecretID: token.SecretID,
|
||||||
},
|
Namespace: token.Namespace,
|
||||||
});
|
Partition: token.Partition,
|
||||||
} catch (e) {
|
},
|
||||||
runInDebug((_) => console.error(e));
|
});
|
||||||
|
} catch (e) {
|
||||||
|
runInDebug((_) => console.error(e));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue