mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
feat(schemas): add cloudflare hostnames configs (#3902)
This commit is contained in:
parent
ff4fb5e56f
commit
2cab3787c1
2 changed files with 38 additions and 3 deletions
5
.changeset/famous-tips-search.md
Normal file
5
.changeset/famous-tips-search.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"@logto/schemas": minor
|
||||
---
|
||||
|
||||
Add cloudflare configurations to system
|
|
@ -97,21 +97,51 @@ export const demoSocialGuard: Readonly<{
|
|||
[DemoSocialKey.DemoSocial]: demoSocialDataGuard,
|
||||
});
|
||||
|
||||
// Cloudflare Hostnames
|
||||
export const hostnameProviderDataGuard = z.object({
|
||||
zoneId: z.string(),
|
||||
apiToken: z.string(), // Requires zone permission for "SSL and Certificates Edit"
|
||||
fallbackOrigin: z.string(), // A domain name
|
||||
});
|
||||
|
||||
export type HostnameProviderData = z.infer<typeof hostnameProviderDataGuard>;
|
||||
|
||||
export enum CloudflareKey {
|
||||
HostnameProvider = 'cloudflareHostnameProvider',
|
||||
}
|
||||
|
||||
export type CloudflareType = {
|
||||
[CloudflareKey.HostnameProvider]: HostnameProviderData;
|
||||
};
|
||||
|
||||
export const cloudflareGuard: Readonly<{
|
||||
[key in CloudflareKey]: ZodType<CloudflareType[key]>;
|
||||
}> = Object.freeze({
|
||||
[CloudflareKey.HostnameProvider]: hostnameProviderDataGuard,
|
||||
});
|
||||
|
||||
// Summary
|
||||
export type SystemKey = AlterationStateKey | StorageProviderKey | DemoSocialKey;
|
||||
export type SystemType = AlterationStateType | StorageProviderType | DemoSocialType;
|
||||
export type SystemKey = AlterationStateKey | StorageProviderKey | DemoSocialKey | CloudflareKey;
|
||||
export type SystemType =
|
||||
| AlterationStateType
|
||||
| StorageProviderType
|
||||
| DemoSocialType
|
||||
| CloudflareType;
|
||||
export type SystemGuard = typeof alterationStateGuard &
|
||||
typeof storageProviderGuard &
|
||||
typeof demoSocialGuard;
|
||||
typeof demoSocialGuard &
|
||||
typeof cloudflareGuard;
|
||||
|
||||
export const systemKeys: readonly SystemKey[] = Object.freeze([
|
||||
...Object.values(AlterationStateKey),
|
||||
...Object.values(StorageProviderKey),
|
||||
...Object.values(DemoSocialKey),
|
||||
...Object.values(CloudflareKey),
|
||||
]);
|
||||
|
||||
export const systemGuards: SystemGuard = Object.freeze({
|
||||
...alterationStateGuard,
|
||||
...storageProviderGuard,
|
||||
...demoSocialGuard,
|
||||
...cloudflareGuard,
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue