diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-11-17 09:12:03 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-11-27 19:40:52 +0100 |
commit | 1b3989b0961d22a5a45ad16239e3c3f58f66180c (patch) | |
tree | 34ef5ede12a7f29ead32caec45d7e73082dfa445 /server/initializers | |
parent | 47e0652b4a98916d4a1d012fbec61afd73a30565 (diff) | |
download | PeerTube-1b3989b0961d22a5a45ad16239e3c3f58f66180c.tar.gz PeerTube-1b3989b0961d22a5a45ad16239e3c3f58f66180c.tar.zst PeerTube-1b3989b0961d22a5a45ad16239e3c3f58f66180c.zip |
Generate application keys too
Diffstat (limited to 'server/initializers')
-rw-r--r-- | server/initializers/installer.ts | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/server/initializers/installer.ts b/server/initializers/installer.ts index 865495722..954516057 100644 --- a/server/initializers/installer.ts +++ b/server/initializers/installer.ts | |||
@@ -6,6 +6,7 @@ import { createLocalAccountWithoutKeys } from '../lib/user' | |||
6 | import { applicationExist, clientsExist, usersExist } from './checker' | 6 | import { applicationExist, clientsExist, usersExist } from './checker' |
7 | import { CACHE, CONFIG, LAST_MIGRATION_VERSION, SERVER_ACCOUNT_NAME } from './constants' | 7 | import { CACHE, CONFIG, LAST_MIGRATION_VERSION, SERVER_ACCOUNT_NAME } from './constants' |
8 | import { database as db } from './database' | 8 | import { database as db } from './database' |
9 | import { createPrivateAndPublicKeys } from '../helpers/peertube-crypto' | ||
9 | 10 | ||
10 | async function installApplication () { | 11 | async function installApplication () { |
11 | try { | 12 | try { |
@@ -136,5 +137,11 @@ async function createApplicationIfNotExist () { | |||
136 | 137 | ||
137 | logger.info('Creating application account.') | 138 | logger.info('Creating application account.') |
138 | 139 | ||
139 | return createLocalAccountWithoutKeys(SERVER_ACCOUNT_NAME, null, applicationInstance.id, undefined) | 140 | const accountCreated = await createLocalAccountWithoutKeys(SERVER_ACCOUNT_NAME, null, applicationInstance.id, undefined) |
141 | |||
142 | const { publicKey, privateKey } = await createPrivateAndPublicKeys() | ||
143 | accountCreated.set('publicKey', publicKey) | ||
144 | accountCreated.set('privateKey', privateKey) | ||
145 | |||
146 | return accountCreated.save() | ||
140 | } | 147 | } |