-
Notifications
You must be signed in to change notification settings - Fork 677
Expand file tree
/
Copy pathwebiny.config.tsx
More file actions
151 lines (135 loc) · 7.49 KB
/
Copy pathwebiny.config.tsx
File metadata and controls
151 lines (135 loc) · 7.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
import React from "react";
import { Admin, Api, Cli, Infra, Project } from "webiny/extensions";
import { FeatureFlag } from "@webiny/project";
import { MyFeature } from "@/extensions/myFeature/Extension.js";
import { AwsExtensions } from "./webiny.config.aws.js";
import { StandaloneExtensions } from "./webiny.config.standalone.js";
import { ApplyDiscountExtension } from "@/extensions/bulkActions/applyDiscount/ApplyDiscountExtension.js";
import { AiContentExtension } from "@/extensions/bulkActions/aiContent/AiContentExtension.js";
/**
* In this monorepo we develop both hosting types. The CLI bin sets WEBINY_HOSTING_TYPE ("aws" via
* `webiny`, "standalone" via `webiny-standalone`). Shared extensions live here; the hosting-specific block
* below pulls in AWS-only (webiny.config.aws.tsx) or standalone-only (webiny.config.standalone.tsx)
* extensions so neither leaks into the other hosting type.
*/
const isStandalone = process.env.WEBINY_HOSTING_TYPE === "standalone";
export const FeatureFlags = () => (
<Project.FeatureFlags
features={{
remoteComponents: true,
fileManager: {
threatDetection: false
},
recordLocking: false
}}
/>
);
export const Extensions = () => {
return (
<>
{/* Admin 👇 */}
<Admin.Extension src={"@/extensions/previewUrlModifier/index.tsx"} />
{/*<Admin.Extension src={"@/extensions/fileUrlFormatter/index.tsx"} />*/}
<Admin.Extension src={"@/extensions/sampleEcommerce/index.tsx"} />
{/*<Admin.Extension src={"@/extensions/saleorEcommerce/index.tsx"} />*/}
<Admin.Extension src={"@/extensions/customPageTypes/index.tsx"} />
<Admin.Extension src={"@/extensions/customPageSettings/index.tsx"} />
<Admin.Extension src={"@/extensions/customFormFieldType/index.tsx"} />
<Admin.Extension src={"@/extensions/commandPalette/index.tsx"} />
{/*<Admin.Extension src={"@/extensions/newEntryWizardDemo/index.tsx"} />*/}
{/* Bulk actions demo: "Apply Discount" bulk action on Products (API + Admin) */}
<ApplyDiscountExtension />
{/* Bulk actions demo: "Generate AI summary" bulk action on Products (API + Admin) */}
{/* IMPORTANT: commented out until we resolve bulk actions bootstrap! */}
<FeatureFlag.CanUseMultiTenancy>
<FeatureFlag.CanUse name="aiPowerups">
<AiContentExtension />
</FeatureFlag.CanUse>
</FeatureFlag.CanUseMultiTenancy>
{/*<Admin.Extension src={"@/extensions/AdminTitleLogo/AdminTitleLogo.tsx"} />*/}
{/*<Admin.Extension src={"/extensions/AdminTheme/AdminTheme.tsx"} />*/}
{/*<Admin.Extension src={"@/extensions/LexicalPlugin.tsx"} />*/}
<MyFeature />
{/* Infra (flavour-agnostic) 👇 */}
<Infra.ProductionEnvironments environments={["prod", "staging"]} />
<Infra.Crypto.Encryption passphrase={"my-passphrase"} />
{/* Optional server-side pepper folded into every hash (e.g. self-hosted auth passwords). */}
<Infra.Crypto.Hashing pepper={"my-hashing-pepper"} />
<Infra.Api.MaxBundleSize size={6291456} />
{/* Api 👇 */}
<Api.Route method={"GET"} path={"/my-api-route"} src={"/extensions/MyApiRoute.ts"} />
{/* Written with `:orderId` on purpose: API Gateway needs `{orderId}` and the router
needs `:orderId`, and the extension converts for each. Either spelling should work. */}
<Api.Route
method={"GET"}
path={"/my-api-echo/:orderId"}
src={"/extensions/MyApiEchoRoute.ts"}
/>
{/*<Api.Extension src={"@/extensions/rendererShowcase/RendererShowcaseModel.ts"} />*/}
{/*<Admin.Extension src={"@/extensions/rendererShowcase/RendererShowcaseModifier.tsx"} />*/}
{/* Bulk actions demo: Products model (the bulk actions themselves are registered
by the <ApplyDiscountExtension /> / <AiContentExtension /> components above) */}
<Api.Extension src={"/extensions/models/ProductCategoryModel.ts"} />
<Api.Extension src={"/extensions/models/ProductModel.ts"} />
{/*<Api.Extension src={"/extensions/models/contactSubmission/ContactSubmissionModel.ts"} />*/}
{/*<Api.Extension src={"/extensions/models/contactSubmission/ContactSubmissionHook.ts"} />*/}
{/*<Admin.Extension*/}
{/* src={"/extensions/models/contactSubmission/EmailEntryListColumn.tsx"}*/}
{/*/>*/}
{/*<Api.BuildParam paramName="MY_CUSTOM_BUILD_PARAM" value="customValue" />*/}
{/*<Api.BuildParam*/}
{/* paramName="MY_CUSTOM_BUILD_PARAM-2"*/}
{/* value={{ myKey: 2, nested: { foo: "bar" } }}*/}
{/*/>*/}
{/*<Admin.BuildParam*/}
{/* paramName="MY_CUSTOM_ADMIN_BUILD_PARAM-2"*/}
{/* value={{ myKey: 2, nested: { foo: "bar" } }}*/}
{/*/>*/}
{/*<Admin.BuildParam paramName="MY_CUSTOM_ADMIN_BUILD_PARAM" value="customAdminValue" />*/}
{/* Project 👇 */}
<Project.Telemetry enabled={false} />
{process.env.WEBINY_CLI_AUTO_INSTALL && (
<Project.AutoInstall
adminUser={{
firstName: "Ad",
lastName: "Min",
email: "admin@webiny.com",
password: "12345678"
}}
/>
)}
{/* Security 👇 */}
<Api.Extension src={"/extensions/MyApiKey.ts"} />
<Api.Extension src={"/extensions/MyApiKeyAfterUpdate.ts"} />
{/* CLI 👇 */}
<Cli.Command src={"/extensions/MyCustomCommand.ts"} />
{/* Bug reporter 👇 The base ships with Webiny via DefaultExtensions and files reports
verbatim. These two are ours: a token so the API files the issue itself, and AI
drafting for the title and steps to reproduce.
Both the token AND the repository have to be set before anything is filed. A token
on its own leaves the reporter in compose mode, so that nobody's local build starts
opening issues on whatever the default repository happens to be. */}
<Project.BugReporter
token={process.env.BUG_REPORT_GITHUB_TOKEN || ""}
repository={process.env.BUG_REPORT_REPOSITORY || ""}
/>
<Api.Extension src={"@/extensions/bugReportAi/Extension.ts"} />
{/* Tasks 👇 */}
<Api.Extension src={"/extensions/tasks/SelfCleaningTask.ts"} />
{/* Headless CMS 👇 */}
{/* Set to true to compress model fields before storing them in the database. */}
<Api.Cms.ModelFieldCompression enabled={false} />
{/* Mailer 👇 */}
<Api.Mailer.Smtp
host={"smtp.webiny.com"}
port={587}
user={"smtp-user"}
password={process.env.SMTP_PASSWORD || "unknown"}
from={"Webiny <test@webiny.com>"}
replyTo={"No-reply <no-reply@webiny.com>"}
/>
{/* Hosting-specific 👇 (AWS: Pulumi + Cognito; Server: Admin.ApiUrl + SelfHostedAuth) */}
{isStandalone ? <StandaloneExtensions /> : <AwsExtensions />}
</>
);
};