Page MenuHomePhorge

D8400.1767090594.diff
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

D8400.1767090594.diff

diff --git a/keyserver/src/database/migration-config.js b/keyserver/src/database/migration-config.js
--- a/keyserver/src/database/migration-config.js
+++ b/keyserver/src/database/migration-config.js
@@ -466,9 +466,47 @@
}
},
],
+ [
+ 39,
+ async () => {
+ ensureUserCredentials();
+ },
+ ],
+ [
+ 40,
+ async () => {
+ await dbQuery(
+ SQL`
+ ALTER TABLE metadata
+ MODIFY COLUMN data VARCHAR(1023);
+ `,
+ );
+ },
+ ],
]);
const newDatabaseVersion: number = Math.max(...migrations.keys());
+async function ensureUserCredentials() {
+ try {
+ const fileHandle = await fs.promises.open(
+ 'secrets/user_credentials.json',
+ 'r',
+ );
+ JSON.parse(await fileHandle.readFile('utf8'));
+ } catch (e) {
+ console.log(
+ 'Please add the follow to secrets/user_credentials.json:\n' +
+ '{\n' +
+ ' . "username": <user>,\n' +
+ ' . "password": <pass>,\n' +
+ '}\n',
+ );
+ // Since we don't want to apply the migrate
+ // throw error now, so check is ran again
+ throw e;
+ }
+}
+
async function writeJSONToFile(data: any, filePath: string): Promise<void> {
console.warn(`updating ${filePath} to ${JSON.stringify(data)}`);
const fileHandle = await fs.promises.open(filePath, 'w');

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 30, 10:29 AM (19 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5866970
Default Alt Text
D8400.1767090594.diff (1 KB)

Event Timeline