Skip to content

Commit

Permalink
Fix https
Browse files Browse the repository at this point in the history
  • Loading branch information
dschmidt committed May 22, 2023
1 parent bd82b16 commit 8de9b9f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions packages/extension-sdk/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import serve from 'rollup-plugin-serve'
const distDir = 'dist'

const certsDir = process.env.OWNCLOUD_CERTS_DIR
const defaultHttps = certsDir && {
key: readFileSync(join(certsDir, 'server.key')),
cert: readFileSync(join(certsDir, 'server.crt'))
}

export const defineConfig = (overrides = {}) => {
return ({ mode }) => {
Expand All @@ -27,7 +31,7 @@ export const defineConfig = (overrides = {}) => {
const name = packageJson.name

// take vite standard config and reuse it for rollup-plugin-serve config
const { https, port = 9210, host = 'localhost' } = overrides?.server
const { https = defaultHttps, port = 9210, host = 'localhost' } = overrides?.server || {}
const isHttps = !!https

if (isServing) {
Expand All @@ -42,12 +46,7 @@ export const defineConfig = (overrides = {}) => {
host,
port,
strictPort: true,
...(certsDir && {
https: {
key: readFileSync(join(certsDir, 'server.key')),
cert: readFileSync(join(certsDir, 'server.crt'))
}
})
...(isHttps && https)
},
resolve: {
alias: {
Expand Down
2 changes: 1 addition & 1 deletion packages/extension-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ownclouders/extension-sdk",
"version": "0.0.1-alpha.3",
"version": "0.0.1-alpha.4",
"description": "ownCloud Web Extension SDK",
"license": "AGPL-3.0",
"main": "index.mjs",
Expand Down

0 comments on commit 8de9b9f

Please sign in to comment.