Skip to content

Commit eb73da8

Browse files
authored
Merge pull request #275 from fosrl/dev
add migration script
2 parents 47abdf8 + cc6800c commit eb73da8

File tree

9 files changed

+68
-9
lines changed

9 files changed

+68
-9
lines changed

server/lib/consts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import path from "path";
22
import { fileURLToPath } from "url";
33

44
// This is a placeholder value replaced by the build process
5-
export const APP_VERSION = "1.0.0-beta.15";
5+
export const APP_VERSION = "1.0.0";
66

77
export const __FILENAME = fileURLToPath(import.meta.url);
88
export const __DIRNAME = path.dirname(__FILENAME);

server/setup/migrations.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import m7 from "./scripts/1.0.0-beta10";
1616
import m8 from "./scripts/1.0.0-beta12";
1717
import m13 from "./scripts/1.0.0-beta13";
1818
import m15 from "./scripts/1.0.0-beta15";
19+
import m16 from "./scripts/1.0.0";
1920

2021
// THIS CANNOT IMPORT ANYTHING FROM THE SERVER
2122
// EXCEPT FOR THE DATABASE AND THE SCHEMA
@@ -31,7 +32,8 @@ const migrations = [
3132
{ version: "1.0.0-beta.10", run: m7 },
3233
{ version: "1.0.0-beta.12", run: m8 },
3334
{ version: "1.0.0-beta.13", run: m13 },
34-
{ version: "1.0.0-beta.15", run: m15 }
35+
{ version: "1.0.0-beta.15", run: m15 },
36+
{ version: "1.0.0", run: m16 }
3537
// Add new migrations here as they are created
3638
] as const;
3739

server/setup/scripts/1.0.0.ts

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import { APP_PATH } from "@server/lib/consts";
2+
import fs from "fs";
3+
import yaml from "js-yaml";
4+
import path from "path";
5+
import { z } from "zod";
6+
import { fromZodError } from "zod-validation-error";
7+
8+
const version = "1.0.0";
9+
10+
export default async function migration() {
11+
console.log(`Running setup script ${version}...`);
12+
13+
try {
14+
const traefikPath = path.join(
15+
APP_PATH,
16+
"traefik",
17+
"traefik_config.yml"
18+
);
19+
20+
const schema = z.object({
21+
experimental: z.object({
22+
plugins: z.object({
23+
badger: z.object({
24+
moduleName: z.string(),
25+
version: z.string()
26+
})
27+
})
28+
})
29+
});
30+
31+
const traefikFileContents = fs.readFileSync(traefikPath, "utf8");
32+
const traefikConfig = yaml.load(traefikFileContents) as any;
33+
34+
const parsedConfig = schema.safeParse(traefikConfig);
35+
36+
if (!parsedConfig.success) {
37+
throw new Error(fromZodError(parsedConfig.error).toString());
38+
}
39+
40+
traefikConfig.experimental.plugins.badger.version = "v1.0.0";
41+
42+
const updatedTraefikYaml = yaml.dump(traefikConfig);
43+
44+
fs.writeFileSync(traefikPath, updatedTraefikYaml, "utf8");
45+
46+
console.log(
47+
"Updated the version of Badger in your Traefik configuration to 1.0.0"
48+
);
49+
} catch (e) {
50+
console.log(
51+
"We were unable to update the version of Badger in your Traefik configuration. Please update it manually."
52+
);
53+
console.error(e);
54+
}
55+
56+
console.log(`${version} migration complete`);
57+
}

src/app/[orgId]/settings/resources/[resourceId]/authentication/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ export default function ResourceAuthenticationPage() {
408408
<SwitchInput
409409
id="sso-toggle"
410410
label="Use Platform SSO"
411-
description="Existing users will only have to login once for all resources that have this enabled."
411+
description="Existing users will only have to log in once for all resources that have this enabled."
412412
defaultChecked={resource.sso}
413413
onCheckedChange={(val) => setSsoEnabled(val)}
414414
/>

src/app/[orgId]/settings/resources/[resourceId]/connectivity/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,7 +455,7 @@ export default function ReverseProxyTargets(props: {
455455
SSL Configuration
456456
</SettingsSectionTitle>
457457
<SettingsSectionDescription>
458-
Setup SSL to secure your connections with certificates
458+
Set up SSL to secure your connections with certificates
459459
</SettingsSectionDescription>
460460
</SettingsSectionHeader>
461461
<SettingsSectionBody>
@@ -477,7 +477,7 @@ export default function ReverseProxyTargets(props: {
477477
Target Configuration
478478
</SettingsSectionTitle>
479479
<SettingsSectionDescription>
480-
Setup targets to route traffic to your services
480+
Set up targets to route traffic to your services
481481
</SettingsSectionDescription>
482482
</SettingsSectionHeader>
483483
<SettingsSectionBody>

src/app/auth/login/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default async function Page(props: {
4141
Looks like you've been invited!
4242
</h2>
4343
<p className="text-center">
44-
To accept the invite, you must login or create an
44+
To accept the invite, you must log in or create an
4545
account.
4646
</p>
4747
</div>

src/app/auth/reset-password/ResetPasswordForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ export default function ResetPasswordForm({
182182
return;
183183
}
184184

185-
setSuccessMessage("Password reset successfully! Back to login...");
185+
setSuccessMessage("Password reset successfully! Back to log in...");
186186

187187
setTimeout(() => {
188188
if (redirect) {

src/app/auth/signup/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export default async function Page(props: {
5757
Looks like you've been invited!
5858
</h2>
5959
<p className="text-center">
60-
To accept the invite, you must login or create an
60+
To accept the invite, you must log in or create an
6161
account.
6262
</p>
6363
</div>

src/app/setup/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export default function StepperForm() {
112112
<>
113113
<Card>
114114
<CardHeader>
115-
<CardTitle>Setup New Organization</CardTitle>
115+
<CardTitle>New Organization</CardTitle>
116116
<CardDescription>
117117
Create your organization, site, and resources
118118
</CardDescription>

0 commit comments

Comments
 (0)