mirror of
https://github.com/cupcakearmy/morphus.git
synced 2025-04-09 18:52:58 +00:00
Compare commits
6 Commits
v1.0.0-rc.
...
main
Author | SHA1 | Date | |
---|---|---|---|
20d2c1b7a0 | |||
008d1c949d | |||
0fc63ed17d | |||
a47d5974e4 | |||
21f570a289 | |||
9500bcf68c |
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,6 +3,7 @@ dist
|
|||||||
assets
|
assets
|
||||||
*.tsbuildinfo
|
*.tsbuildinfo
|
||||||
data
|
data
|
||||||
|
demo
|
||||||
.vscode
|
.vscode
|
||||||
|
|
||||||
# Configs
|
# Configs
|
||||||
|
@ -3,6 +3,8 @@ FROM node:16-alpine as base
|
|||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN npm -g i pnpm@7
|
RUN npm -g i pnpm@7
|
||||||
|
# Needed for node-gyp
|
||||||
|
RUN apk add --no-cache python3
|
||||||
|
|
||||||
# BUILDER
|
# BUILDER
|
||||||
FROM base as builder
|
FROM base as builder
|
||||||
|
@ -24,9 +24,9 @@ The heavy lifting is done by [`libvips`](https://github.com/libvips/libvips) and
|
|||||||
- Domain protection
|
- Domain protection
|
||||||
- Host verification
|
- Host verification
|
||||||
- Multiple storage adapters (Local, Minio, S3, GCP)
|
- Multiple storage adapters (Local, Minio, S3, GCP)
|
||||||
- Auto format based on `Accept` header and `user-agent`
|
- Auto format based on `Accept` header
|
||||||
- ETag caching
|
- ETag caching
|
||||||
- Presets and optinal forcing of presets
|
- Presets and optional forcing of presets
|
||||||
|
|
||||||
## 🏗 Installation
|
## 🏗 Installation
|
||||||
|
|
||||||
|
BIN
design/round.png
BIN
design/round.png
Binary file not shown.
Before Width: | Height: | Size: 162 KiB After Width: | Height: | Size: 163 KiB |
4
docker/local/morphus.yaml
Normal file
4
docker/local/morphus.yaml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
logLevel: warn
|
||||||
|
|
||||||
|
allowedDomains:
|
||||||
|
- example.org
|
14
package.json
14
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "morphus",
|
"name": "morphus",
|
||||||
"version": "1.0.0-rc.2",
|
"version": "1.0.0-rc.3",
|
||||||
"description": "",
|
"description": "",
|
||||||
"author": "Niccolo Borgioli",
|
"author": "Niccolo Borgioli",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@ -20,12 +20,12 @@
|
|||||||
"@types/convict": "^6.1.1",
|
"@types/convict": "^6.1.1",
|
||||||
"@types/flat": "^5.0.2",
|
"@types/flat": "^5.0.2",
|
||||||
"@types/js-yaml": "^4.0.5",
|
"@types/js-yaml": "^4.0.5",
|
||||||
"@types/minio": "^7.0.13",
|
"@types/minio": "^7.0.14",
|
||||||
"@types/ms": "^0.7.31",
|
"@types/ms": "^0.7.31",
|
||||||
"@types/node": "^16.11.36",
|
"@types/node": "^16.11.66",
|
||||||
"@types/sharp": "^0.29.5",
|
"@types/sharp": "^0.29.5",
|
||||||
"ts-node-dev": "^2.0.0",
|
"ts-node-dev": "^2.0.0",
|
||||||
"typescript": "^4.7.2"
|
"typescript": "^4.8.4"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fastify/caching": "^7.0.0",
|
"@fastify/caching": "^7.0.0",
|
||||||
@ -36,13 +36,13 @@
|
|||||||
"convict": "^6.2.3",
|
"convict": "^6.2.3",
|
||||||
"convict-format-with-validator": "^6.2.0",
|
"convict-format-with-validator": "^6.2.0",
|
||||||
"fast-crc32c": "^2.0.0",
|
"fast-crc32c": "^2.0.0",
|
||||||
"fastify": "^3.29.0",
|
"fastify": "^3.29.3",
|
||||||
"flat": "^5.0.2",
|
"flat": "^5.0.2",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"minio": "^7.0.28",
|
"minio": "^7.0.32",
|
||||||
"ms": "^2.1.3",
|
"ms": "^2.1.3",
|
||||||
"pino-pretty": "^7.6.1",
|
"pino-pretty": "^7.6.1",
|
||||||
"sharp": "^0.29.3",
|
"sharp": "^0.31.1",
|
||||||
"under-pressure": "^5.8.1"
|
"under-pressure": "^5.8.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
491
pnpm-lock.yaml
generated
491
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@ -2,9 +2,10 @@ import { config, StorageType } from '../dist/src/config.js'
|
|||||||
|
|
||||||
const schema = config._def
|
const schema = config._def
|
||||||
|
|
||||||
function stringAsMarkdownCode(string) {
|
const asInlineCode = (s) => '`' + s + '`'
|
||||||
return '`' + string + '`'
|
const formatInline = (s, empty = '') => (s === undefined ? empty : asInlineCode(s))
|
||||||
}
|
const formatEnv = (s) => formatInline(s, 'not supported')
|
||||||
|
const formatDefault = (s) => formatInline(s, '')
|
||||||
|
|
||||||
for (const storage of Object.values(StorageType)) {
|
for (const storage of Object.values(StorageType)) {
|
||||||
const storageType = schema[storage]
|
const storageType = schema[storage]
|
||||||
@ -13,7 +14,21 @@ for (const storage of Object.values(StorageType)) {
|
|||||||
| ---------------- | ------------------ | ------- | ------------------------ |
|
| ---------------- | ------------------ | ------- | ------------------------ |
|
||||||
`
|
`
|
||||||
for (const [key, value] of Object.entries(storageType)) {
|
for (const [key, value] of Object.entries(storageType)) {
|
||||||
table += `| \`${storage}.${key}\` | \`${value.env}\` | ${value.default} | ${value.doc} |\n`
|
table += `| \`${storage}.${key}\` | ${formatEnv(value.env)} | ${formatDefault(value.default)} | ${value.doc} |\n`
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(table)
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
let table = `
|
||||||
|
| Config | Environment | Default | Description |
|
||||||
|
| ------- | ----------- | ------- | ------------ |
|
||||||
|
`
|
||||||
|
|
||||||
|
for (const [key, value] of Object.entries(schema)) {
|
||||||
|
if (Object.values(StorageType).includes(key)) continue
|
||||||
|
table += `| ${asInlineCode(key)} | ${formatEnv(value.env)} | ${formatDefault(value.default)} | ${value.doc} |\n`
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(table)
|
console.log(table)
|
||||||
|
@ -83,14 +83,14 @@ export const config = convict({
|
|||||||
format: formatNullableStringOrRegexpArray,
|
format: formatNullableStringOrRegexpArray,
|
||||||
default: null as NullableStringOrRegexpArray,
|
default: null as NullableStringOrRegexpArray,
|
||||||
nullable: true,
|
nullable: true,
|
||||||
env: 'ALLOWED_DOMAINS',
|
// env: 'ALLOWED_DOMAINS', // See: https://github.com/mozilla/node-convict/issues/399
|
||||||
},
|
},
|
||||||
allowedHosts: {
|
allowedHosts: {
|
||||||
doc: 'The hosts that are allowed to access the images',
|
doc: 'The hosts that are allowed to access the images',
|
||||||
format: formatNullableStringOrRegexpArray,
|
format: formatNullableStringOrRegexpArray,
|
||||||
default: null as NullableStringOrRegexpArray,
|
default: null as NullableStringOrRegexpArray,
|
||||||
nullable: true,
|
nullable: true,
|
||||||
env: 'ALLOWED_HOSTS',
|
// env: 'ALLOWED_HOSTS', // See: https://github.com/mozilla/node-convict/issues/399
|
||||||
},
|
},
|
||||||
cleanUrls: {
|
cleanUrls: {
|
||||||
doc: 'Whether to clean URLs',
|
doc: 'Whether to clean URLs',
|
||||||
@ -103,7 +103,7 @@ export const config = convict({
|
|||||||
maxAge: {
|
maxAge: {
|
||||||
doc: 'The maximum age of a cached image',
|
doc: 'The maximum age of a cached image',
|
||||||
format: String,
|
format: String,
|
||||||
default: '1d',
|
default: '90d',
|
||||||
env: 'MAX_AGE',
|
env: 'MAX_AGE',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user