Page MenuHomePhabricator

D3577.diff
No OneTemporary

D3577.diff

diff --git a/docs/dev_environment.md b/docs/dev_environment.md
--- a/docs/dev_environment.md
+++ b/docs/dev_environment.md
@@ -498,7 +498,7 @@
{
"baseDomain": "http://localhost",
"basePath": "/comm/",
- "baseRoutePath": "/comm/",
+ "baseRoutePath": "/",
"https": false
}
```
diff --git a/server/src/database/migrations.js b/server/src/database/migrations.js
--- a/server/src/database/migrations.js
+++ b/server/src/database/migrations.js
@@ -30,6 +30,22 @@
await writeFile.close();
}
+async function fixBaseRoutePathForLocalhost(filePath: string): Promise<void> {
+ const readFile = await fs.promises.open(filePath, 'r');
+ const contents = await readFile.readFile('utf8');
+ let json = JSON.parse(contents);
+ await readFile.close();
+ if (json.baseDomain !== 'http://localhost') {
+ return;
+ }
+ const baseRoutePath = '/';
+ json = { ...json, baseRoutePath };
+ console.warn(`updating ${filePath} to ${JSON.stringify(json)}`);
+ const writeFile = await fs.promises.open(filePath, 'w');
+ await writeFile.writeFile(JSON.stringify(json, null, ' '), 'utf8');
+ await writeFile.close();
+}
+
const migrations: $ReadOnlyMap<number, () => Promise<void>> = new Map([
[
0,
@@ -46,6 +62,13 @@
} catch {}
},
],
+ [
+ 2,
+ async () => {
+ await fixBaseRoutePathForLocalhost('facts/commapp_url.json');
+ await fixBaseRoutePathForLocalhost('facts/squadcal_url.json');
+ },
+ ],
]);
async function migrate(): Promise<boolean> {

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 3, 12:44 PM (22 h, 13 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2611715
Default Alt Text
D3577.diff (1 KB)

Event Timeline