ci(config): 👷 use custome hostname in dev mode to avoid polluting browser hsts, ... caches

This commit is contained in:
Julien Oculi 2024-07-16 21:16:41 +02:00
parent 72b0794c61
commit 2ded36b38b
6 changed files with 40 additions and 29 deletions

View file

@ -29,6 +29,7 @@ TODO
### Local watch mode
```sh
echo 'cohabit.localhost' >> /etc/hosts # In sudo, one time
mkcert -install # If mkcert is not installed in your root ca
mkcert -ecdsa localhost # Only once to issue localhost certificates
deno task start

View file

@ -0,0 +1,5 @@
-----BEGIN PRIVATE KEY-----
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgQle6WkhHFzsMAYYM
4ENVHV4V5KWbanc3LrUBcjdJDbWhRANCAARfrO3QAofR9xUEfL7aZ9TdjW0ArwP2
u8wPIpb7VF5VDMI2vKS9ZpRnBLi0C1ovaPRCxv/GgEiU8OGvSU7HqCig
-----END PRIVATE KEY-----

View file

@ -0,0 +1,22 @@
-----BEGIN CERTIFICATE-----
MIIDmDCCAgCgAwIBAgIQGtdX8GxPjHNzcuZ7j0G/yzANBgkqhkiG9w0BAQsFADCB
kzEeMBwGA1UEChMVbWtjZXJ0IGRldmVsb3BtZW50IENBMTQwMgYDVQQLDCtKT1RT
Ui1WSVZPXEp1bGllbkBKT1RTUi1WSVZPIChKdWxpZW4gT2N1bGkpMTswOQYDVQQD
DDJta2NlcnQgSk9UU1ItVklWT1xKdWxpZW5ASk9UU1ItVklWTyAoSnVsaWVuIE9j
dWxpKTAeFw0yNDA3MTYxOTAzMjlaFw0yNjEwMTYxOTAzMjlaMF8xJzAlBgNVBAoT
Hm1rY2VydCBkZXZlbG9wbWVudCBjZXJ0aWZpY2F0ZTE0MDIGA1UECwwrSk9UU1It
VklWT1xKdWxpZW5ASk9UU1ItVklWTyAoSnVsaWVuIE9jdWxpKTBZMBMGByqGSM49
AgEGCCqGSM49AwEHA0IABF+s7dACh9H3FQR8vtpn1N2NbQCvA/a7zA8ilvtUXlUM
wja8pL1mlGcEuLQLWi9o9ELG/8aASJTw4a9JTseoKKCjZjBkMA4GA1UdDwEB/wQE
AwIFoDATBgNVHSUEDDAKBggrBgEFBQcDATAfBgNVHSMEGDAWgBSZlnlvvqnFAC7S
mu9R/5f6lkgJ/TAcBgNVHREEFTATghFjb2hhYml0LmxvY2FsaG9zdDANBgkqhkiG
9w0BAQsFAAOCAYEAHSD1EZUxz0a/RnJa3uD0p+IAlHPbF8jb5GEZwLLbeyqadkFw
ITYc/8JGp77jCcxj0VfHhY8UJDTPi1j0LkcRbQFBZZ+ZkQ+yCOp8uAKh0JHgUHMf
rO/98Zf06XE6Dt1Di9w0BW24+wVe6hZ9pfQTI7KMsg+XbAXEsWdd2YB7xsL0AIkP
L9E2RU8vbF5sST2FXxjQkjVIMcLesMGNSQsrBZpp68OAjklub9H3wYpplMlyBGdV
WXc8QS2wVNPSsS1HPQZThdbMG6TfTlyljOPIEvQtAEKZTPbBIy4ICJmbLknkDAJ9
+76SROj6sr0g1v4Sz3DumLgx8TOxWqCFFfKeQHY4V/DaZYkyjgQiudyiia2vNvLu
vl2j+y/ee0fOAS1JoxZ9OnDkvlgRrVlfL6yQHq8V+0wW5PPJcV67NfF1DtuFSZSf
/M/O1lt+s593/SngIKtCsW8rJn8h0pR8ZwewzNmzVI9/F0xETOVypSZr3gCFd8kl
CUS0RV5N6fGkwTGL
-----END CERTIFICATE-----

View file

@ -1,5 +0,0 @@
-----BEGIN PRIVATE KEY-----
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgWGTG/X7/vLtzInr9
k482dpSC7bZvV3us2FkWqJFe1XWhRANCAASmrapDgQf6kVlMPsSOHeoCB+Z0+P0L
K3x95uUa6igELdVtXJPaSJJksytjXWGCpsn9RhkCO2XKdSvqW/9QVcYn
-----END PRIVATE KEY-----

View file

@ -1,22 +0,0 @@
-----BEGIN CERTIFICATE-----
MIIDkTCCAfmgAwIBAgIRAItJkjr6cwdtBbymbjslLOowDQYJKoZIhvcNAQELBQAw
gZMxHj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rysKHmDfyjH932o6ENVEWMdwvNly6MC2SsZHHQd
jj/O04tWmdN7gtEkmxZfGTGSmx2GUPfJssNEH8pLYxU/MUENAOk2cl/2SIeziaf8
gNtrzYA=
-----END CERTIFICATE-----

14
dev.ts
View file

@ -5,10 +5,20 @@ import config from './fresh.config.ts'
import '$std/dotenv/load.ts'
const hostname = 'cohabit.localhost'
await dev(import.meta.url, './main.ts', {
...config,
server: {
cert: await Deno.readTextFile('./cert/localhost.pem'),
key: await Deno.readTextFile('./cert/localhost-key.pem'),
cert: await Deno.readTextFile('./cert/cohabit.localhost.pem'),
key: await Deno.readTextFile('./cert/cohabit.localhost-key.pem'),
hostname,
onListen: (({ port }) => {
console.log(
`\n\t%c Server started %c %chttps://${hostname}:${port}\n`,
'font-weight: bold; background-color: blue',
'',
'color: blue; text-decoration: underline'
)
})
},
})