Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support paths for SSL cert/key #13563

Closed
zumm opened this issue Mar 29, 2022 · 6 comments
Closed

Support paths for SSL cert/key #13563

zumm opened this issue Mar 29, 2022 · 6 comments

Comments

@zumm
Copy link

zumm commented Mar 29, 2022

At this moment nuxt supports cert/key only as content (NITRO_SSL_CERT/NITRO_SSL_KEY env vars). Can support of paths be added too? It would improve DX with using .env file.

@danielroe
Copy link
Member

danielroe commented Mar 29, 2022

This would increase the size of the default Nitro server, and it would have to include FS access, which wouldn't work in non-Node environments. But you can easily implement this yourself.

NITRO_SSL_CERT=$(cat server.crt) NITRO_SSL_KEY=$(cat server.key) node .output/server/index.mjs

@zumm
Copy link
Author

zumm commented Mar 29, 2022

Yes, but it requires extract running command from scripts section of package.json or make it cross-platform in some way.

Can dotenv dependency be updated to v15 for multiline value support at least?

@pi0
Copy link
Member

pi0 commented Mar 29, 2022

.env file is not loaded with the production bundle of nitro.

You can create a server.mjs file for cross platform support:

#!/bin/env/node
import fs from 'fs'

process.env.NITRO_SSL_CERT = fs.readFileSync('server.crt')
process.env.NITRO_SSL_KEY = fs.readFileSync('server.key')

await import('./.output/server/index.mjs')

@pi0
Copy link
Member

pi0 commented Apr 12, 2022

We shall improve documentation with unjs/nitro#85

@pi0 pi0 closed this as completed Apr 12, 2022
@danielroe danielroe added the 3.x label Jan 19, 2023
@danielroe danielroe transferred this issue from nuxt/framework Jan 19, 2023
@bitbytebit1
Copy link

Sorry to grave dig but I'm curious, could you clarify what you mean when you say non-Node environments?

@danielroe
Copy link
Member

For example, on Cloudflare, Bun, Deno or Lagon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants