Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32508893
D8400.1767090594.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D8400.1767090594.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D8400: [Keyserver] Apply DB Migrations
Attached
Detach File
Event Timeline
Log In to Comment