Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3513815
D5846.id19734.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D5846.id19734.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
@@ -57,8 +57,8 @@
ALTER TABLE users
DROP COLUMN IF EXISTS public_key,
MODIFY hash char(60) COLLATE utf8mb4_bin DEFAULT NULL;
-
- ALTER TABLE sessions
+
+ ALTER TABLE sessions
DROP COLUMN IF EXISTS public_key;
`,
{ multipleStatements: true },
@@ -110,13 +110,21 @@
async () => {
const time = Date.now();
await dbQuery(SQL`
- INSERT IGNORE INTO policy_acknowledgments (policy, user, date,
+ INSERT IGNORE INTO policy_acknowledgments (policy, user, date,
confirmed)
SELECT ${policyTypes.tosAndPrivacyPolicy}, id, ${time}, 1
FROM users
`);
},
],
+ [
+ 12,
+ async () => {
+ await writeSquadCalRoute('facts/squadcal_url.json');
+ await moveToNonApacheConfig('facts/commapp_url.json', '/comm/');
+ await moveToNonApacheConfig('facts/landing_url.json', '/commlanding/');
+ },
+ ],
]);
const newDatabaseVersion: number = Math.max(...migrations.keys());
@@ -175,4 +183,46 @@
await writeFile.close();
}
+async function writeJSONToFile(data: object, filePath: string): Promise<void> {
+ console.warn(`updating ${filePath} to ${JSON.stringify(data)}`);
+ const writeFile = await fs.promises.open(filePath, 'w');
+ await writeFile.writeFile(JSON.stringify(data, null, ' '), 'utf8');
+ await writeFile.close();
+}
+
+async function moveToNonApacheConfig(
+ filePath: string,
+ routePath: string,
+): Promise<void> {
+ if (process.env.COMM_DATABASE_HOST) {
+ return;
+ }
+ // Since the non-Apache config is so opinionated, just write expected config
+ const newJSON = {
+ baseDomain: 'http://localhost:3000',
+ basePath: routePath,
+ baseRoutePath: routePath,
+ https: false,
+ proxy: 'none',
+ };
+
+ writeJSONToFile(newJSON, filePath);
+}
+
+async function writeSquadCalRoute(filePath: string): Promise<void> {
+ if (process.env.COMM_DATABASE_HOST) {
+ return;
+ }
+ // Since the non-Apache config is so opinionated, just write expected config
+ const newJSON = {
+ baseDomain: 'http://localhost:3000',
+ basePath: '/comm/',
+ baseRoutePath: '/',
+ https: false,
+ proxy: 'apache',
+ };
+
+ writeJSONToFile(newJSON, filePath);
+}
+
export { migrations, newDatabaseVersion };
diff --git a/native/utils/url-utils.js b/native/utils/url-utils.js
--- a/native/utils/url-utils.js
+++ b/native/utils/url-utils.js
@@ -26,11 +26,11 @@
}
function getDevNodeServerURLFromHostname(hostname: string): string {
- return `http://${hostname}/comm`;
+ return `http://${hostname}:3000/comm`;
}
function getDevLandingURLFromHostname(hostname: string): string {
- return `http://${hostname}/commlanding`;
+ return `http://${hostname}:3000/commlanding`;
}
function getDevNodeServerURL(): string {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 23, 2:18 AM (19 h, 11 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2693186
Default Alt Text
D5846.id19734.diff (2 KB)
Attached To
Mode
D5846: [Keyserver] Migrate to non-apache config, update native
Attached
Detach File
Event Timeline
Log In to Comment