Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32816414
D5846.1768045180.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D5846.1768045180.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
@@ -129,9 +129,26 @@
`);
},
],
+ [
+ 13,
+ async () => {
+ await Promise.all([
+ writeSquadCalRoute('facts/squadcal_url.json'),
+ moveToNonApacheConfig('facts/commapp_url.json', '/comm/'),
+ moveToNonApacheConfig('facts/landing_url.json', '/commlanding/'),
+ ]);
+ },
+ ],
]);
const newDatabaseVersion: number = Math.max(...migrations.keys());
+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');
+ await fileHandle.writeFile(JSON.stringify(data, null, ' '), 'utf8');
+ await fileHandle.close();
+}
+
async function makeSureBaseRoutePathExists(filePath: string): Promise<void> {
let readFile, json;
try {
@@ -158,9 +175,7 @@
}
const newJSON = { ...json, baseRoutePath };
console.warn(`updating ${filePath} to ${JSON.stringify(newJSON)}`);
- const writeFile = await fs.promises.open(filePath, 'w');
- await writeFile.writeFile(JSON.stringify(newJSON, null, ' '), 'utf8');
- await writeFile.close();
+ await writeJSONToFile(newJSON, filePath);
}
async function fixBaseRoutePathForLocalhost(filePath: string): Promise<void> {
@@ -182,9 +197,42 @@
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();
+ await writeJSONToFile(json, filePath);
+}
+
+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',
+ };
+
+ await 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',
+ };
+
+ await 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
Sat, Jan 10, 11:39 AM (1 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5914925
Default Alt Text
D5846.1768045180.diff (3 KB)
Attached To
Mode
D5846: [Keyserver] Migrate to non-apache config, update native
Attached
Detach File
Event Timeline
Log In to Comment