mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-20 12:42:34 +02:00
90 lines
1.8 KiB
TypeScript
90 lines
1.8 KiB
TypeScript
import { DomainOrWildcards as DomainsOrWildcards, Email } from "../types";
|
|
|
|
export const AUTOCERT_PROVIDERS = [
|
|
"local",
|
|
"cloudflare",
|
|
"clouddns",
|
|
"duckdns",
|
|
"ovh",
|
|
] as const;
|
|
|
|
export type AutocertProvider = (typeof AUTOCERT_PROVIDERS)[number];
|
|
|
|
export type AutocertConfig =
|
|
| LocalOptions
|
|
| CloudflareOptions
|
|
| CloudDNSOptions
|
|
| DuckDNSOptions
|
|
| OVHOptionsWithAppKey
|
|
| OVHOptionsWithOAuth2Config;
|
|
|
|
export interface AutocertConfigBase {
|
|
/* ACME email */
|
|
email: Email;
|
|
/* ACME domains */
|
|
domains: DomainsOrWildcards;
|
|
/* ACME certificate path */
|
|
cert_path?: string;
|
|
/* ACME key path */
|
|
key_path?: string;
|
|
}
|
|
|
|
export interface LocalOptions extends AutocertConfigBase {
|
|
provider: "local";
|
|
}
|
|
|
|
export interface CloudflareOptions extends AutocertConfigBase {
|
|
provider: "cloudflare";
|
|
options: { auth_token: string };
|
|
}
|
|
|
|
export interface CloudDNSOptions extends AutocertConfigBase {
|
|
provider: "clouddns";
|
|
options: {
|
|
client_id: string;
|
|
email: Email;
|
|
password: string;
|
|
};
|
|
}
|
|
|
|
export interface DuckDNSOptions extends AutocertConfigBase {
|
|
provider: "duckdns";
|
|
options: {
|
|
token: string;
|
|
};
|
|
}
|
|
|
|
export const OVH_ENDPOINTS = [
|
|
"ovh-eu",
|
|
"ovh-ca",
|
|
"ovh-us",
|
|
"kimsufi-eu",
|
|
"kimsufi-ca",
|
|
"soyoustart-eu",
|
|
"soyoustart-ca",
|
|
] as const;
|
|
|
|
export type OVHEndpoint = (typeof OVH_ENDPOINTS)[number];
|
|
|
|
export interface OVHOptionsWithAppKey extends AutocertConfigBase {
|
|
provider: "ovh";
|
|
options: {
|
|
application_secret: string;
|
|
consumer_key: string;
|
|
api_endpoint?: OVHEndpoint;
|
|
application_key: string;
|
|
};
|
|
}
|
|
|
|
export interface OVHOptionsWithOAuth2Config extends AutocertConfigBase {
|
|
provider: "ovh";
|
|
options: {
|
|
application_secret: string;
|
|
consumer_key: string;
|
|
api_endpoint?: OVHEndpoint;
|
|
oauth2_config: {
|
|
client_id: string;
|
|
client_secret: string;
|
|
};
|
|
};
|
|
}
|