-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* better acme ux * fix patching arrays... again --------- Co-authored-by: Aiden McClelland <[email protected]>
- Loading branch information
Showing
7 changed files
with
149 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,7 +65,7 @@ export const mockPatchData: DataModel = { | |
}, | ||
}, | ||
acme: { | ||
[Object.keys(knownACME)[0]]: { | ||
[knownACME[0].url]: { | ||
contact: ['mailto:[email protected]'], | ||
}, | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
export function toAcmeName(url: ACME_URL | string | null): ACME_Name | string { | ||
return ( | ||
Object.entries(knownACME).find(([_, val]) => val === url)?.[0] || | ||
url || | ||
'System CA' | ||
) | ||
export function toAcmeName(url: string | null): string | 'System CA' { | ||
return knownACME.find(acme => acme.url === url)?.name || url || 'System CA' | ||
} | ||
|
||
export function toAcmeUrl(name: ACME_Name | string): ACME_URL | string { | ||
return knownACME[name as ACME_Name] || name | ||
export function toAcmeUrl(name: string): string { | ||
return knownACME.find(acme => acme.name === name)?.url || name | ||
} | ||
|
||
export const knownACME = { | ||
'Let\'s Encrypt': 'https://acme-v02.api.letsencrypt.org/directory', | ||
'Let\'s Encrypt (Staging)': | ||
'https://acme-staging-v02.api.letsencrypt.org/directory', | ||
} | ||
|
||
export type ACME_Name = keyof typeof knownACME | ||
|
||
export type ACME_URL = (typeof knownACME)[ACME_Name] | ||
export const knownACME: { | ||
name: string | ||
url: string | ||
}[] = [ | ||
{ | ||
name: `Let's Encrypt`, | ||
url: 'https://acme-v02.api.letsencrypt.org/directory', | ||
}, | ||
{ | ||
name: `Let's Encrypt (Staging)`, | ||
url: 'https://acme-staging-v02.api.letsencrypt.org/directory', | ||
}, | ||
] |