miolo 3.0.0-beta.21 → 3.0.0-beta.210
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/build/build.mjs +53 -0
- package/bin/build/build_bin.mjs +17 -0
- package/bin/build/cli/client.mjs +52 -0
- package/bin/build/cli/css.mjs +22 -0
- package/bin/build/cli/index.mjs +40 -0
- package/bin/build/cli/ssr.mjs +21 -0
- package/bin/build/server/aliases.mjs +112 -0
- package/bin/build/server/babel.config.js +24 -0
- package/bin/build/server/banner.mjs +20 -0
- package/bin/build/server/bundle.mjs +111 -0
- package/bin/build/server/fix.mjs +15 -0
- package/bin/build/server/index.mjs +69 -0
- package/bin/build/server/options.mjs +83 -0
- package/bin/create/auth.mjs +23 -0
- package/bin/create/copy.mjs +175 -0
- package/bin/create/docker.mjs +25 -0
- package/bin/create/index.mjs +137 -0
- package/bin/create/pkgjson.mjs +72 -0
- package/bin/create/prepare-template.mjs +158 -0
- package/bin/create/validation.mjs +27 -0
- package/bin/dev/dev.mjs +32 -23
- package/bin/dev/dev_start.mjs +6 -5
- package/bin/index.mjs +94 -52
- package/bin/prod-bin/create-bin.mjs +42 -27
- package/bin/prod-bin/run.mjs +13 -9
- package/bin/{prod-run → run}/pid.mjs +4 -4
- package/bin/run/restart.mjs +13 -0
- package/bin/run/start.mjs +18 -0
- package/bin/run/stop.mjs +20 -0
- package/bin/util.mjs +35 -11
- package/package.json +59 -39
- package/src/config/.env +34 -12
- package/src/config/defaults.mjs +253 -185
- package/src/config/env.mjs +40 -22
- package/src/config/index.mjs +19 -24
- package/src/config/util.mjs +25 -10
- package/src/db-conn.mjs +34 -0
- package/src/engines/cron/emails.mjs +10 -5
- package/src/engines/cron/index.mjs +45 -51
- package/src/engines/cron/init.mjs +16 -17
- package/src/engines/cron/ipsum.mjs +65 -60
- package/src/engines/cron/syscheck.mjs +30 -30
- package/src/engines/emailer/index.mjs +1 -2
- package/src/engines/emailer/queue.mjs +14 -20
- package/src/engines/emailer/transporter.mjs +86 -74
- package/src/engines/geoip/index.mjs +23 -28
- package/src/engines/http/index.mjs +26 -15
- package/src/engines/logger/buildErrorEmailBody.mjs +72 -0
- package/src/engines/logger/index.mjs +114 -122
- package/src/engines/logger/injectStackTrace.mjs +59 -0
- package/src/engines/logger/logger_mail.mjs +47 -61
- package/src/engines/logger/reopenTransportOnHupSignal.mjs +12 -13
- package/src/engines/parser/Parser.mjs +77 -60
- package/src/engines/parser/index.mjs +1 -1
- package/src/engines/schema/diffObjs.mjs +41 -0
- package/src/engines/schema/index.mjs +4 -0
- package/src/engines/schema/input.mjs +54 -0
- package/src/engines/schema/output.mjs +66 -0
- package/src/engines/socket/index.mjs +44 -46
- package/src/index.mjs +15 -10
- package/src/middleware/auth/basic.mjs +41 -40
- package/src/middleware/auth/custom.mjs +10 -13
- package/src/middleware/auth/guest.mjs +27 -27
- package/src/middleware/auth/passport/index.mjs +374 -0
- package/src/middleware/auth/passport/session/index.mjs +43 -0
- package/src/middleware/auth/{credentials → passport}/session/store.mjs +35 -15
- package/src/middleware/auth/passport/session/store_koa_redis.mjs +3 -0
- package/src/middleware/context/cache/index.mjs +78 -33
- package/src/middleware/context/cache/options.mjs +19 -21
- package/src/middleware/context/db.mjs +45 -20
- package/src/middleware/context/index.mjs +12 -12
- package/src/middleware/extra.mjs +4 -5
- package/src/middleware/http/body.mjs +25 -25
- package/src/middleware/http/catcher.mjs +81 -8
- package/src/middleware/http/custom_blacklist.mjs +19 -16
- package/src/middleware/http/headers.mjs +37 -34
- package/src/middleware/http/ratelimit.mjs +16 -23
- package/src/middleware/http/request.mjs +60 -65
- package/src/middleware/routes/catch_js_error.mjs +30 -23
- package/src/middleware/routes/robots.mjs +4 -7
- package/src/middleware/routes/router/crud/attachCrudRoutes.mjs +108 -90
- package/src/middleware/routes/router/crud/getCrudConfig.mjs +31 -55
- package/src/middleware/routes/router/defaults.mjs +6 -19
- package/src/middleware/routes/router/index.mjs +17 -21
- package/src/middleware/routes/router/queries/attachQueriesRoutes.mjs +227 -50
- package/src/middleware/routes/router/queries/getQueriesConfig.mjs +45 -55
- package/src/middleware/routes/router/utils.mjs +41 -26
- package/src/middleware/ssr/context.mjs +5 -7
- package/src/middleware/ssr/html.mjs +66 -43
- package/src/middleware/ssr/loader.mjs +11 -14
- package/src/middleware/ssr/ssr_render.mjs +39 -22
- package/src/middleware/static/index.mjs +33 -14
- package/src/middleware/vite/devserver.mjs +38 -22
- package/src/middleware/vite/watcher.mjs +12 -14
- package/src/server-cron.mjs +13 -8
- package/src/server-dev.mjs +13 -16
- package/src/server.mjs +49 -51
- package/template/.agent/skills/miolo-app-arch/SKILL.md +218 -0
- package/template/.agent/skills/miolo-auth/SKILL.md +450 -0
- package/template/.agent/skills/miolo-cli-router/SKILL.md +394 -0
- package/template/.agent/skills/miolo-database/SKILL.md +358 -0
- package/template/.agent/skills/miolo-react-patterns/SKILL.md +426 -0
- package/template/.agent/skills/miolo-routing/SKILL.md +326 -0
- package/template/.agent/skills/miolo-schemas/SKILL.md +329 -0
- package/template/.agent/skills/miolo-session-context/SKILL.md +397 -0
- package/template/.agent/skills/miolo-ssr/SKILL.md +433 -0
- package/template/.editorconfig +18 -0
- package/template/.env +120 -0
- package/template/biome.json +63 -0
- package/template/components.json +21 -0
- package/template/db/init.sh +89 -0
- package/template/db/sql/00_drop.sql +2 -0
- package/template/db/sql/01_users.sql +31 -0
- package/template/db/sql/02_todos.sql +20 -0
- package/template/docker/Dockerfile +13 -0
- package/template/docker/docker-compose.yaml +79 -0
- package/template/gitignore +42 -0
- package/template/jsconfig.json +18 -0
- package/template/package.json +88 -0
- package/template/postcss.config.js +9 -0
- package/template/src/cli/App.jsx +25 -0
- package/template/src/cli/components/JsonTreeViewer.jsx +128 -0
- package/template/src/cli/components/shadcn-io/spinner/index.jsx +232 -0
- package/template/src/cli/components/stepper.jsx +408 -0
- package/template/src/cli/components/ui/avatar.jsx +36 -0
- package/template/src/cli/components/ui/badge.jsx +31 -0
- package/template/src/cli/components/ui/breadcrumb.jsx +97 -0
- package/template/src/cli/components/ui/card.jsx +73 -0
- package/template/src/cli/components/ui/collapsible.jsx +16 -0
- package/template/src/cli/components/ui/dropdown-menu.jsx +179 -0
- package/template/src/cli/components/ui/field.jsx +217 -0
- package/template/src/cli/components/ui/input.jsx +19 -0
- package/template/src/cli/components/ui/label.jsx +17 -0
- package/template/src/cli/components/ui/pagination.jsx +99 -0
- package/template/src/cli/components/ui/patched/alert.jsx +56 -0
- package/template/src/cli/components/ui/patched/button.jsx +45 -0
- package/template/src/cli/components/ui/patched/dialog.jsx +114 -0
- package/template/src/cli/components/ui/patched/sidebar.jsx +660 -0
- package/template/src/cli/components/ui/select.jsx +141 -0
- package/template/src/cli/components/ui/separator.jsx +21 -0
- package/template/src/cli/components/ui/sheet.jsx +115 -0
- package/template/src/cli/components/ui/skeleton.jsx +13 -0
- package/template/src/cli/components/ui/sonner.jsx +22 -0
- package/template/src/cli/components/ui/switch.jsx +25 -0
- package/template/src/cli/components/ui/table.jsx +88 -0
- package/template/src/cli/components/ui/textarea.jsx +16 -0
- package/template/src/cli/components/ui/tooltip.jsx +45 -0
- package/template/src/cli/config/store_keys.mjs +2 -0
- package/template/src/cli/context/data/DataContext.jsx +5 -0
- package/template/src/cli/context/data/DataProvider.jsx +44 -0
- package/template/src/cli/context/data/useBreads.mjs +15 -0
- package/template/src/cli/context/data/useDataContext.mjs +4 -0
- package/template/src/cli/context/session/SessionContext.mjs +4 -0
- package/template/src/cli/context/session/SessionProvider.jsx +31 -0
- package/template/src/cli/context/session/makePermissioner.mjs +34 -0
- package/template/src/cli/context/session/useSessionContext.mjs +6 -0
- package/template/src/cli/context/theme/ThemeContext.mjs +4 -0
- package/template/src/cli/context/theme/ThemeProvider.jsx +49 -0
- package/template/src/cli/context/theme/useThemeContext.mjs +6 -0
- package/template/src/cli/context/ui/UIContext.jsx +5 -0
- package/template/src/cli/context/ui/UIProvider.jsx +16 -0
- package/template/src/cli/context/ui/useUIContext.mjs +4 -0
- package/template/src/cli/context/util.mjs +17 -0
- package/template/src/cli/entry-cli.jsx +33 -0
- package/template/src/cli/hooks/useIsMobile.mjs +19 -0
- package/template/src/cli/hooks/useStoragedState.mjs +63 -0
- package/template/src/cli/index.html +29 -0
- package/template/src/cli/layout/app-sidebar.jsx +25 -0
- package/template/src/cli/layout/main-layout.jsx +63 -0
- package/template/src/cli/layout/nav-last-todos.jsx +72 -0
- package/template/src/cli/layout/nav-main.jsx +39 -0
- package/template/src/cli/layout/nav-user.jsx +105 -0
- package/template/src/cli/layout/prop-switcher.jsx +93 -0
- package/template/src/cli/lib/utils.mjs +10 -0
- package/template/src/cli/pages/Index.jsx +13 -0
- package/template/src/cli/pages/IndexOffline.jsx +13 -0
- package/template/src/cli/pages/IndexOnline.jsx +18 -0
- package/template/src/cli/pages/dash/Dashboard.jsx +29 -0
- package/template/src/cli/pages/offline/Login.jsx +43 -0
- package/template/src/cli/pages/offline/LoginForm.jsx +115 -0
- package/template/src/cli/pages/security/Security.jsx +39 -0
- package/template/src/cli/pages/security/SecurityForm.jsx +106 -0
- package/template/src/cli/pages/todos/TodoActions.jsx +99 -0
- package/template/src/cli/pages/todos/TodoAdd.jsx +43 -0
- package/template/src/cli/pages/todos/TodoList.jsx +60 -0
- package/template/src/cli/pages/todos/Todos.jsx +23 -0
- package/template/src/cli/pages/todos/context/TodosContext.jsx +5 -0
- package/template/src/cli/pages/todos/context/TodosProvider.jsx +191 -0
- package/template/src/cli/pages/todos/context/useTodosContext.mjs +4 -0
- package/template/src/ns/models/Todo.mjs +29 -0
- package/template/src/ns/models/TodoList.mjs +8 -0
- package/template/src/ns/models/User.mjs +40 -0
- package/template/src/server/bot/check_today.mjs +10 -0
- package/template/src/server/io/cache/base.mjs +21 -0
- package/template/src/server/io/db/filter.mjs +92 -0
- package/template/src/server/io/db/todos/delete.mjs +29 -0
- package/template/src/server/io/db/todos/find.mjs +13 -0
- package/template/src/server/io/db/todos/read.mjs +83 -0
- package/template/src/server/io/db/todos/toggle.mjs +37 -0
- package/template/src/server/io/db/todos/upsave.mjs +32 -0
- package/template/src/server/io/db/triggers/user.mjs +13 -0
- package/template/src/server/io/db/users/auth.mjs +132 -0
- package/template/src/server/io/db/users/pwd.mjs +38 -0
- package/template/src/server/io/db/users/save.mjs +17 -0
- package/template/src/server/miolo/auth/basic.mjs +15 -0
- package/template/src/server/miolo/auth/guest.mjs +3 -0
- package/template/src/server/miolo/auth/passport.mjs +73 -0
- package/template/src/server/miolo/cache.mjs +11 -0
- package/template/src/server/miolo/cron/foo.mjs +7 -0
- package/template/src/server/miolo/cron/index.mjs +28 -0
- package/template/src/server/miolo/cron/invalidate.mjs +21 -0
- package/template/src/server/miolo/db.mjs +36 -0
- package/template/src/server/miolo/http.mjs +14 -0
- package/template/src/server/miolo/index.mjs +43 -0
- package/template/src/server/miolo/routes/crud.mjs +16 -0
- package/template/src/server/miolo/routes/index.mjs +8 -0
- package/template/src/server/miolo/ssr/entry-server.jsx +13 -0
- package/template/src/server/miolo/ssr/loader.mjs +18 -0
- package/template/src/server/routes/index.mjs +66 -0
- package/template/src/server/routes/todos/mod.mjs +52 -0
- package/template/src/server/routes/todos/read.mjs +45 -0
- package/template/src/server/routes/todos/special.mjs +47 -0
- package/template/src/server/routes/users/user.mjs +54 -0
- package/template/src/server/server.mjs +10 -0
- package/template/src/server/utils/crypt.mjs +38 -0
- package/template/src/server/utils/io.mjs +15 -0
- package/template/src/server/utils/pwdfor.mjs +25 -0
- package/template/src/server/utils/schema.mjs +22 -0
- package/template/src/static/img/default/profile.png +0 -0
- package/template/src/static/img/favicon.ico +0 -0
- package/template/src/static/img/miolo_logo.png +0 -0
- package/template/src/static/img/miolo_name.png +0 -0
- package/template/src/static/public/manifest.json +21 -0
- package/template/src/static/public/sw.js +79 -0
- package/template/src/static/style/globals.css +156 -0
- package/template/src/static/style/json-tree.css +54 -0
- package/template/src/static/style/skeleton.css +49 -0
- package/bin/prod-build/build-client.mjs +0 -67
- package/bin/prod-build/build-server.mjs +0 -58
- package/bin/prod-run/restart.mjs +0 -9
- package/bin/prod-run/start.mjs +0 -15
- package/bin/prod-run/stop.mjs +0 -20
- package/src/engines/logger/verify.mjs +0 -22
- package/src/middleware/auth/credentials/index.mjs +0 -151
- package/src/middleware/auth/credentials/session/index.mjs +0 -24
- package/src/middleware/auth/credentials/session/store_koa_redis.mjs +0 -3
package/src/config/defaults.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import path from
|
|
2
|
-
const SESSION_MAX_AGE = 86400 * 10 * 1000
|
|
1
|
+
import path from "node:path"
|
|
3
2
|
|
|
3
|
+
const SESSION_MAX_AGE = 86400 * 10 * 1000
|
|
4
|
+
const root = (dir) => path.resolve(process.cwd(), dir)
|
|
4
5
|
|
|
5
6
|
//
|
|
6
7
|
// Notice `miolo` has support for `.env` files
|
|
@@ -8,124 +9,144 @@ const SESSION_MAX_AGE = 86400 * 10 * 1000
|
|
|
8
9
|
// and set the variables you want to use.
|
|
9
10
|
// Then you can configure miolo using process.env.WHATEVER.
|
|
10
11
|
|
|
11
|
-
|
|
12
12
|
export default function make_config_defaults() {
|
|
13
|
-
|
|
14
13
|
return {
|
|
15
|
-
name: process.env.MIOLO_NAME ||
|
|
14
|
+
name: process.env.MIOLO_NAME || "miolo",
|
|
16
15
|
http: {
|
|
17
16
|
port: process.env?.MIOLO_PORT || 8001,
|
|
18
|
-
hostname:
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
hostname:
|
|
18
|
+
process.env?.IS_DOCKER === "true"
|
|
19
|
+
? process.env?.MIOLO_HOSTNAME_DOCKER || "0.0.0.0"
|
|
20
|
+
: process.env?.MIOLO_HOSTNAME || "localhost",
|
|
21
|
+
|
|
22
|
+
ssl: undefined,
|
|
23
|
+
//ssl: {
|
|
24
|
+
// key: fs.readFileSync('.../key.pem'),
|
|
25
|
+
// cert: fs.readFileSync('.../cert.pem'),
|
|
26
|
+
// }
|
|
27
|
+
|
|
28
|
+
catcher_url: "/sys/jserror",
|
|
21
29
|
|
|
22
|
-
catcher_url: '/sys/jserror',
|
|
23
|
-
|
|
24
30
|
static: {
|
|
25
|
-
favicon:
|
|
26
|
-
|
|
31
|
+
favicon: root("src/static/img/favicon.ico"),
|
|
32
|
+
headers: {
|
|
33
|
+
"/sw.js": {
|
|
34
|
+
"Cache-Control": "no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0"
|
|
35
|
+
}
|
|
36
|
+
//"/index.html": { "Cache-Control": "no-cache, max-age=0" },
|
|
37
|
+
//"/": { "Cache-Control": "no-cache, max-age=0" }
|
|
38
|
+
},
|
|
39
|
+
folders: {
|
|
40
|
+
"/build": root("build"),
|
|
41
|
+
"/static": root("src/static"),
|
|
42
|
+
"/": root("src/static/public")
|
|
43
|
+
}
|
|
27
44
|
},
|
|
28
|
-
|
|
45
|
+
|
|
29
46
|
// cors can be:
|
|
30
47
|
// - false
|
|
31
48
|
// - simple (just assign Access-Control-Allow-Origin='*' and Access-Control-Expose-Headers='SourceMap,X-SourceMap'
|
|
32
49
|
// - true enable @koa/cors
|
|
33
50
|
// - {options} enable @koa/cors and use the custom options
|
|
34
51
|
//
|
|
35
|
-
cors:
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
52
|
+
cors:
|
|
53
|
+
process.env.MIOLO_HTTP_CORS === "true"
|
|
54
|
+
? true
|
|
55
|
+
: process.env.MIOLO_HTTP_CORS === "simple"
|
|
56
|
+
? "simple"
|
|
57
|
+
: false,
|
|
40
58
|
|
|
41
59
|
// proxy can be:
|
|
42
60
|
// - false
|
|
43
61
|
// - true enable koa-proxies and use default options
|
|
44
62
|
// - {options} enable koa-proxies and use the custom options
|
|
45
|
-
proxy: process.env.MIOLO_HTTP_PROXY===
|
|
63
|
+
proxy: process.env.MIOLO_HTTP_PROXY === "true",
|
|
46
64
|
|
|
47
65
|
ratelimit: {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
errorMessage: 'Rate Limit reached',
|
|
66
|
+
max: parseInt(process.env.MIOLO_RATELIMIT_MAX || 1000, 10),
|
|
67
|
+
duration: parseInt(process.env.MIOLO_RATELIMIT_DURATION || 60 * 1000, 10), // miliseconds
|
|
68
|
+
errorMessage: "Rate Limit reached",
|
|
52
69
|
//whitelist: (ctx) => false,
|
|
53
70
|
//blacklist: (ctx) => false,
|
|
54
|
-
whitelist_ips: process.env.MIOLO_RATELIMIT_WHITELIST_IPS?.split(
|
|
55
|
-
blacklist_ips: process.env.MIOLO_RATELIMIT_BLACKLIST_IPS?.split(
|
|
56
|
-
ipsum_folder:
|
|
71
|
+
whitelist_ips: process.env.MIOLO_RATELIMIT_WHITELIST_IPS?.split(",") || [],
|
|
72
|
+
blacklist_ips: process.env.MIOLO_RATELIMIT_BLACKLIST_IPS?.split(",") || [],
|
|
73
|
+
ipsum_folder: "/var/ipsum" // https://github.com/stamparm/ipsum
|
|
57
74
|
},
|
|
58
75
|
|
|
59
76
|
request: {
|
|
60
|
-
lazy: parseInt(process.env.MIOLO_REQUEST_LAZY || 1), // seconds to consider lazy a request
|
|
61
|
-
slow: parseInt(process.env.MIOLO_REQUEST_SLOW || 2), // seconds to consider slow a request
|
|
77
|
+
lazy: parseInt(process.env.MIOLO_REQUEST_LAZY || 1, 10), // seconds to consider lazy a request
|
|
78
|
+
slow: parseInt(process.env.MIOLO_REQUEST_SLOW || 2, 10), // seconds to consider slow a request
|
|
62
79
|
onStart: undefined,
|
|
63
80
|
// (ctx, times) => { return begin_result}
|
|
64
81
|
onDone: undefined,
|
|
65
82
|
// (ctx, begin_result, times) => {},
|
|
66
83
|
geoip: {
|
|
67
|
-
enabled: process.env.MIOLO_GEOIP_ENABLED===
|
|
84
|
+
enabled: process.env.MIOLO_GEOIP_ENABLED === "true",
|
|
68
85
|
db: process.env.MIOLO_GEOIP_DB,
|
|
69
|
-
local_ips: process.env.MIOLO_GEOIP_LOCAL_IPS?.split(
|
|
70
|
-
'127.0.0.1'
|
|
71
|
-
]
|
|
86
|
+
local_ips: process.env.MIOLO_GEOIP_LOCAL_IPS?.split(",") || ["127.0.0.1"]
|
|
72
87
|
}
|
|
73
88
|
}
|
|
74
|
-
|
|
75
89
|
},
|
|
76
90
|
session: {
|
|
77
|
-
salt: process.env.MIOLO_SESSION_SALT ||
|
|
78
|
-
secret: process.env.MIOLO_SESSION_SECRET ||
|
|
91
|
+
salt: process.env.MIOLO_SESSION_SALT || "SUPER_SALTY_YES?",
|
|
92
|
+
secret: process.env.MIOLO_SESSION_SECRET || "SUPER_SECRET_KEY_KERE",
|
|
79
93
|
options: {
|
|
94
|
+
/** (string) cookie key (default is koa.sess) */
|
|
95
|
+
key: process.env.MIOLO_SESSION_KEY || `${process.env.MIOLO_NAME || "koa"}.sess`,
|
|
80
96
|
/** (number || 'session') maxAge in ms (default is 1 days) */
|
|
81
97
|
/** 'session' will result in a cookie that expires when session/browser is closed */
|
|
82
98
|
/** Warning: If a session cookie is stolen, this cookie will never expire */
|
|
83
|
-
maxAge: parseInt(process.env.MIOLO_SESSION_MAX_AGE || SESSION_MAX_AGE),
|
|
84
|
-
|
|
99
|
+
maxAge: parseInt(process.env.MIOLO_SESSION_MAX_AGE || SESSION_MAX_AGE, 10),
|
|
100
|
+
|
|
85
101
|
/** (boolean) automatically commit headers (default true) */
|
|
86
|
-
//autoCommit: true,
|
|
87
|
-
|
|
102
|
+
//autoCommit: true,
|
|
103
|
+
|
|
88
104
|
/** (boolean) can overwrite or not (default true) */
|
|
89
|
-
//overwrite: true,
|
|
90
|
-
|
|
105
|
+
//overwrite: true,
|
|
106
|
+
|
|
91
107
|
/** (boolean) httpOnly or not (default true) */
|
|
92
|
-
//httpOnly: true,
|
|
93
|
-
|
|
108
|
+
//httpOnly: true,
|
|
109
|
+
|
|
94
110
|
/** (boolean) signed or not (default true) */
|
|
95
|
-
//signed: true,
|
|
96
|
-
|
|
111
|
+
//signed: true,
|
|
112
|
+
|
|
97
113
|
/** (boolean) Force a session identifier cookie to be set on every response. The expiration is reset to the original maxAge, resetting the expiration countdown. (default is false) */
|
|
98
|
-
//rolling: false,
|
|
99
|
-
|
|
114
|
+
//rolling: false,
|
|
115
|
+
|
|
100
116
|
/** (boolean) renew session when session is nearly expired, so we can always keep user logged in. (default is false)*/
|
|
101
|
-
|
|
117
|
+
renew: process.env?.MIOLO_SESSION_RENEW === "true",
|
|
102
118
|
|
|
103
119
|
/** (boolean) secure cookie*/
|
|
104
120
|
/** You may want to set it as true in your Production environement,
|
|
105
121
|
* while false at DEV time.
|
|
106
122
|
*/
|
|
107
|
-
secure: process.env?.MIOLO_SESSION_SECURE ===
|
|
108
|
-
|
|
123
|
+
secure: process.env?.MIOLO_SESSION_SECURE === "true",
|
|
124
|
+
|
|
109
125
|
/** (string) session cookie sameSite options (default null, don't set it) */
|
|
110
|
-
|
|
126
|
+
/** NOTE: Google Auth requires 'lax' */
|
|
127
|
+
sameSite: process.env.MIOLO_SESSION_SAME_SITE || "lax" // 'strict',
|
|
111
128
|
}
|
|
112
129
|
},
|
|
113
130
|
db: {
|
|
114
131
|
config: {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
132
|
+
dialect: process.env.MIOLO_DB_DIALECT || "postgres",
|
|
133
|
+
host:
|
|
134
|
+
process.env?.IS_DOCKER === "true"
|
|
135
|
+
? process.env.MIOLO_DB_DOCKER_HOST || "postgres"
|
|
136
|
+
: process.env.MIOLO_DB_HOST || "localhost",
|
|
137
|
+
port: process.env.MIOLO_DB_PORT || 5432,
|
|
138
|
+
database: process.env.MIOLO_DB_DATABASE,
|
|
139
|
+
filename: process.env.MIOLO_DB_FILENAME,
|
|
140
|
+
user: process.env.MIOLO_DB_USER,
|
|
141
|
+
password: process.env.MIOLO_DB_PASSWORD,
|
|
142
|
+
// Maximum number of connection in pool
|
|
143
|
+
max: parseInt(process.env.MIOLO_DB_POOL_MAX || 5, 10),
|
|
144
|
+
// Minimum number of connection in pool
|
|
145
|
+
min: parseInt(process.env.MIOLO_DB_POOL_MIN || 0, 10),
|
|
146
|
+
// The maximum time, in milliseconds, that a connection can be idle before being released.
|
|
147
|
+
// Use with combination of evict for proper working,
|
|
148
|
+
// for more details read https://github.com/coopernurse/node-pool/issues/178#issuecomment-327110870,
|
|
149
|
+
idleTimeoutMillis: parseInt(process.env.MIOLO_DB_POOL_IDLE_TIMEOUT_MS || 10000, 10)
|
|
129
150
|
},
|
|
130
151
|
options: {
|
|
131
152
|
tables: []
|
|
@@ -133,28 +154,32 @@ export default function make_config_defaults() {
|
|
|
133
154
|
// cache:
|
|
134
155
|
// Refer to top level cache option
|
|
135
156
|
// cache: {...}
|
|
136
|
-
|
|
157
|
+
|
|
137
158
|
// log:
|
|
138
159
|
// We will pass, on the fly, miolo logger to calustra
|
|
139
160
|
// But specifying a level here, we can customize the level only for db/calustra actions
|
|
140
|
-
// log: 'silly',
|
|
161
|
+
// log: 'silly',
|
|
141
162
|
}
|
|
142
163
|
},
|
|
143
164
|
routes: {
|
|
144
165
|
bodyField: undefined,
|
|
145
|
-
|
|
166
|
+
|
|
146
167
|
// auth: {
|
|
147
168
|
// require: false, // true / false / 'read-only'
|
|
148
169
|
// action: 'redirect', // 'error'
|
|
149
170
|
// redirect_url: '/',
|
|
150
171
|
// error_code: 401
|
|
151
|
-
// },
|
|
172
|
+
// },
|
|
152
173
|
// before: async (ctx) => {return bool} // If bool false, query callback not run
|
|
153
|
-
//
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
174
|
+
// it can also be an array of functions
|
|
175
|
+
// after : async (ctx, data) => {return modified_data}
|
|
176
|
+
// it can also be an array of functions
|
|
177
|
+
|
|
178
|
+
crud: [
|
|
179
|
+
{
|
|
180
|
+
prefix: "",
|
|
181
|
+
routes: [
|
|
182
|
+
/*
|
|
158
183
|
name: '',
|
|
159
184
|
url: '/../..', // default to 'name'
|
|
160
185
|
mode: 'r/w/rw',
|
|
@@ -170,9 +195,12 @@ export default function make_config_defaults() {
|
|
|
170
195
|
auth: ...,
|
|
171
196
|
before: ...,
|
|
172
197
|
after : ...
|
|
173
|
-
*/
|
|
174
|
-
|
|
175
|
-
|
|
198
|
+
*/
|
|
199
|
+
]
|
|
200
|
+
}
|
|
201
|
+
],
|
|
202
|
+
queries: [
|
|
203
|
+
/*
|
|
176
204
|
{
|
|
177
205
|
prefix: '',
|
|
178
206
|
auth: ...,
|
|
@@ -183,31 +211,43 @@ export default function make_config_defaults() {
|
|
|
183
211
|
{
|
|
184
212
|
url: '/../..',
|
|
185
213
|
method: 'GET/POST',
|
|
186
|
-
callback: async (ctx) => {
|
|
187
|
-
|
|
188
|
-
|
|
214
|
+
callback: async (ctx, params) => {
|
|
215
|
+
return {ok: true/false, data|error}
|
|
216
|
+
// or:
|
|
217
|
+
// return <anything>
|
|
218
|
+
// and milo will wrap into {ok: true, data: <anything>}
|
|
219
|
+
// or by yourself:
|
|
220
|
+
// ctx.body = {ok: true/false, data|error}
|
|
221
|
+
// (you may want {keep_body: true})
|
|
222
|
+
} ,
|
|
189
223
|
auth: ...,
|
|
190
|
-
before:
|
|
191
|
-
after :
|
|
224
|
+
before: async (ctx) => { return true/false } or array of functions,
|
|
225
|
+
after : async (ctx, data) => { return data } or array of functions,
|
|
226
|
+
schema: {
|
|
227
|
+
input: a Joi schema for validating input data,
|
|
228
|
+
output: a Joi schema for validating output data,
|
|
229
|
+
}
|
|
230
|
+
keep_body: false by default. If true, miolo wont ensure ctx.body after callback.
|
|
192
231
|
},
|
|
193
232
|
],
|
|
194
233
|
},
|
|
195
|
-
*/
|
|
234
|
+
*/
|
|
235
|
+
]
|
|
196
236
|
},
|
|
197
237
|
log: {
|
|
198
|
-
level: process.env.MIOLO_LOG_LEVEL ||
|
|
238
|
+
level: process.env.MIOLO_LOG_LEVEL || "debug",
|
|
199
239
|
format: {
|
|
200
|
-
locale:
|
|
240
|
+
locale: "en-GB"
|
|
201
241
|
},
|
|
202
242
|
console: {
|
|
203
|
-
enabled: process.env.MIOLO_LOG_CONSOLE_ENABLED ===
|
|
204
|
-
level: process.env.MIOLO_LOG_CONSOLE_LEVEL || process.env.MIOLO_LOG_LEVEL ||
|
|
243
|
+
enabled: process.env.MIOLO_LOG_CONSOLE_ENABLED === "true",
|
|
244
|
+
level: process.env.MIOLO_LOG_CONSOLE_LEVEL || process.env.MIOLO_LOG_LEVEL || "debug"
|
|
205
245
|
},
|
|
206
246
|
file: {
|
|
207
|
-
enabled: process.env.MIOLO_LOG_FILE_ENABLED ===
|
|
208
|
-
level: process.env.MIOLO_LOG_FILE_LEVEL || process.env.MIOLO_LOG_LEVEL ||
|
|
209
|
-
filename: process.env.MIOLO_LOG_FILE_PATH ||
|
|
210
|
-
|
|
247
|
+
enabled: process.env.MIOLO_LOG_FILE_ENABLED === "true",
|
|
248
|
+
level: process.env.MIOLO_LOG_FILE_LEVEL || process.env.MIOLO_LOG_LEVEL || "debug",
|
|
249
|
+
filename: process.env.MIOLO_LOG_FILE_PATH || "/var/log/afialapis/%MIOLO%.log",
|
|
250
|
+
|
|
211
251
|
//frequency: undefined,
|
|
212
252
|
//datePattern: 'YYYY-MM-DD',
|
|
213
253
|
zippedArchive: true,
|
|
@@ -226,45 +266,45 @@ export default function make_config_defaults() {
|
|
|
226
266
|
hup_patch: false
|
|
227
267
|
},
|
|
228
268
|
mail: {
|
|
229
|
-
enabled: process.env.MIOLO_LOG_MAIL_ENABLED
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
level: process.env.MIOLO_LOG_MAIL_LEVEL || process.env.MIOLO_LOG_LEVEL ||
|
|
233
|
-
name: process.env.MIOLO_NAME ||
|
|
234
|
-
from: process.env.MIOLO_LOG_MAIL_FROM ||
|
|
235
|
-
to: process.env.MIOLO_LOG_MAIL_TO ||
|
|
269
|
+
enabled: process.env.MIOLO_LOG_MAIL_ENABLED
|
|
270
|
+
? process.env.MIOLO_LOG_MAIL_ENABLED === "true"
|
|
271
|
+
: false,
|
|
272
|
+
level: process.env.MIOLO_LOG_MAIL_LEVEL || process.env.MIOLO_LOG_LEVEL || "warn",
|
|
273
|
+
name: process.env.MIOLO_NAME || "miolo",
|
|
274
|
+
from: process.env.MIOLO_LOG_MAIL_FROM || "noreply@mail.com",
|
|
275
|
+
to: process.env.MIOLO_LOG_MAIL_TO || "noreply@mail.com"
|
|
236
276
|
}
|
|
237
277
|
},
|
|
238
278
|
mail: {
|
|
239
|
-
silent: process.env.MIOLO_MAILER_SILENT ===
|
|
279
|
+
silent: process.env.MIOLO_MAILER_SILENT === "true",
|
|
240
280
|
options: {
|
|
241
281
|
//
|
|
242
282
|
// General options
|
|
243
283
|
//
|
|
244
284
|
// port – is the port to connect to (defaults to 587 is secure is false or 465 if true)
|
|
245
|
-
port: parseInt(process.env.MIOLO_MAILER_PORT || 25),
|
|
285
|
+
port: parseInt(process.env.MIOLO_MAILER_PORT || 25, 10),
|
|
246
286
|
// host – is the hostname or IP address to connect to (defaults to ‘localhost’)
|
|
247
|
-
host: process.env.MIOLO_MAILER_HOST ||
|
|
248
|
-
// auth – defines authentication data
|
|
249
|
-
// If authentication data is not present, the connection is considered authenticated from the start.
|
|
287
|
+
host: process.env.MIOLO_MAILER_HOST || "mail.com",
|
|
288
|
+
// auth – defines authentication data
|
|
289
|
+
// If authentication data is not present, the connection is considered authenticated from the start.
|
|
250
290
|
// Otherwise you would need to provide the authentication options object.
|
|
251
291
|
// - type indicates the authetication type, defaults to ‘login’, other option is ‘oauth2’
|
|
252
292
|
// - user is the username
|
|
253
293
|
// - pass is the password for the user if normal login is used
|
|
254
294
|
// authMethod – defines preferred authentication method, defaults to ‘PLAIN’
|
|
255
|
-
authMethod: process.env.MIOLO_MAILER_AUTH_METHOD ||
|
|
256
|
-
...
|
|
295
|
+
authMethod: process.env.MIOLO_MAILER_AUTH_METHOD || "PLAIN",
|
|
296
|
+
...(process.env.MIOLO_MAILER_AUTH_METHOD === "LOGIN"
|
|
257
297
|
? {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
298
|
+
auth: {
|
|
299
|
+
user: process.env.MIOLO_MAILER_SMTP_USER || "noreply@mail.com",
|
|
300
|
+
pass: process.env.MIOLO_MAILER_SMTP_PASS || "****",
|
|
301
|
+
type: "login"
|
|
302
|
+
},
|
|
303
|
+
secure: true
|
|
304
|
+
}
|
|
265
305
|
: {
|
|
266
|
-
|
|
267
|
-
|
|
306
|
+
secure: false
|
|
307
|
+
}),
|
|
268
308
|
|
|
269
309
|
//
|
|
270
310
|
// TLS options
|
|
@@ -272,18 +312,17 @@ export default function make_config_defaults() {
|
|
|
272
312
|
// secure – if true the connection will use TLS when connecting to server.
|
|
273
313
|
// If false (the default) then TLS is used if server supports the STARTTLS extension.
|
|
274
314
|
// In most cases set this value to true if you are connecting to port 465. For port 587 or 25 keep it false
|
|
275
|
-
// ** Setting secure to false does not mean that you would not use an encrypted connection. Most SMTP servers allow
|
|
315
|
+
// ** Setting secure to false does not mean that you would not use an encrypted connection. Most SMTP servers allow
|
|
276
316
|
// connection upgrade via STARTTLS command but to use this you have to connect using plaintext first
|
|
277
|
-
|
|
278
|
-
|
|
317
|
+
|
|
279
318
|
// tls – defines additional node.js TLSSocket options to be passed to the socket constructor, eg. {rejectUnauthorized: true}.
|
|
280
319
|
tls: {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
}
|
|
320
|
+
// do not fail on invalid certs
|
|
321
|
+
rejectUnauthorized: false
|
|
322
|
+
},
|
|
284
323
|
// ignoreTLS – if this is true and secure is false then TLS is not used even if the server supports STARTTLS extension
|
|
285
324
|
// ** ignoreTLS: false,
|
|
286
|
-
// requireTLS – if this is true and secure is false then Nodemailer tries to use STARTTLS even
|
|
325
|
+
// requireTLS – if this is true and secure is false then Nodemailer tries to use STARTTLS even
|
|
287
326
|
// if the server does not advertise support for it. If the connection can not be encrypted then message is not sent
|
|
288
327
|
// ** requireTLS: true,
|
|
289
328
|
//
|
|
@@ -302,15 +341,15 @@ export default function make_config_defaults() {
|
|
|
302
341
|
//
|
|
303
342
|
// Debug options
|
|
304
343
|
//
|
|
305
|
-
// logger – optional bunyan compatible logger instance. If set to true then logs to console.
|
|
344
|
+
// logger – optional bunyan compatible logger instance. If set to true then logs to console.
|
|
306
345
|
// If value is not set or is false then nothing is logged
|
|
307
346
|
logger: false,
|
|
308
347
|
// debug – if set to true, then logs SMTP traffic, otherwise logs only transaction events
|
|
309
|
-
debug: false
|
|
348
|
+
debug: false
|
|
310
349
|
//
|
|
311
350
|
// Security options
|
|
312
351
|
//
|
|
313
|
-
// disableFileAccess – if true, then does not allow to use files as content.
|
|
352
|
+
// disableFileAccess – if true, then does not allow to use files as content.
|
|
314
353
|
// Use it when you want to use JSON data from untrusted source as the email.
|
|
315
354
|
// If an attachment or message node tries to fetch something from a file the sending returns an error
|
|
316
355
|
////disableFileAccess: ,
|
|
@@ -328,9 +367,9 @@ export default function make_config_defaults() {
|
|
|
328
367
|
// Read about proxy support in Nodemailer from here: https://nodemailer.com/smtp/proxies/
|
|
329
368
|
},
|
|
330
369
|
defaults: {
|
|
331
|
-
name: process.env.MIOLO_NAME ||
|
|
332
|
-
from: process.env.MIOLO_MAILER_FROM ||
|
|
333
|
-
to: process.env.MIOLO_MAILER_TO ||
|
|
370
|
+
name: process.env.MIOLO_NAME || "miolo",
|
|
371
|
+
from: process.env.MIOLO_MAILER_FROM || "noreply@mail.com",
|
|
372
|
+
to: process.env.MIOLO_MAILER_TO || "noreply@mail.com"
|
|
334
373
|
}
|
|
335
374
|
},
|
|
336
375
|
auth: {
|
|
@@ -339,29 +378,32 @@ export default function make_config_defaults() {
|
|
|
339
378
|
// realm: '',
|
|
340
379
|
// paths: [],
|
|
341
380
|
//},
|
|
342
|
-
//credentials: {
|
|
343
|
-
// get_user_id: (user, done, miolo) => done(null, user.id), // default
|
|
344
|
-
// find_user_by_id: (id, done, miolo) => done(null, {id: 1}), // ok=> done(null, user) err=> done(error, null)
|
|
345
|
-
// local_auth_user: (username, password, done, miolo) => done(null, {id: 1})
|
|
346
|
-
// // auth=> done(null, user) noauth=> done(null, false, {message: ''}) err=> done(error, null)
|
|
347
|
-
// url_login : '/login',
|
|
348
|
-
// url_logout: '/logout',
|
|
349
|
-
// url_login_redirect: undefined
|
|
350
|
-
// url_logout_redirect: '/'
|
|
351
|
-
//}
|
|
352
381
|
//guest: {
|
|
353
382
|
// make_guest_token: undefined // (session) => ''
|
|
354
383
|
//},
|
|
355
|
-
//
|
|
356
|
-
//
|
|
357
|
-
//
|
|
358
|
-
//
|
|
359
|
-
//
|
|
360
|
-
//
|
|
361
|
-
//
|
|
362
|
-
//
|
|
363
|
-
//
|
|
364
|
-
//
|
|
384
|
+
//passport: {
|
|
385
|
+
// get_user_id: (user, done, ctx) => done(null, user.id), // default
|
|
386
|
+
// find_user_by_id: (id, done, ctx) => done(null, {id: 1}), // ok=> done(null, user) err=> done(error, null)
|
|
387
|
+
// local_auth_user: (username, password, done, ctx) => done(null, {id: 1})
|
|
388
|
+
// auth => done(null, user)
|
|
389
|
+
// noauth=> done(null, false, {message: ''})
|
|
390
|
+
// err => done(error, null)
|
|
391
|
+
// local_url_login : '/login',
|
|
392
|
+
// local_url_logout: '/logout',
|
|
393
|
+
// local_url_login_redirect: '/
|
|
394
|
+
// local_url_logout_redirect: '/'
|
|
395
|
+
// google_auth_user: (accessToken, refreshToken, profile, done, ctx) => done(null, {id: 1})
|
|
396
|
+
// auth => done(null, user)
|
|
397
|
+
// noauth=> done(null, false, {message: ''})
|
|
398
|
+
// err => done(error, null)
|
|
399
|
+
// google_client_id: 'your-google-client-id',
|
|
400
|
+
// google_client_secret: 'your-google-client-secret',
|
|
401
|
+
// google_url_login : '/auth/google',
|
|
402
|
+
// google_url_callback : '/auth/google/callback',
|
|
403
|
+
// google_url_logout: '/logout',
|
|
404
|
+
// google_url_login_redirect: undefined
|
|
405
|
+
// google_url_logout_redirect: '/'
|
|
406
|
+
//}
|
|
365
407
|
},
|
|
366
408
|
|
|
367
409
|
middlewares: [
|
|
@@ -371,7 +413,7 @@ export default function make_config_defaults() {
|
|
|
371
413
|
cron: [
|
|
372
414
|
// {
|
|
373
415
|
// name,
|
|
374
|
-
// cronTime,
|
|
416
|
+
// cronTime,
|
|
375
417
|
// onTick: async (miolo, onComplete),
|
|
376
418
|
// Notice that if task runs too fast, you may see that
|
|
377
419
|
// onTick is actually never run, but onComplete is.
|
|
@@ -388,44 +430,59 @@ export default function make_config_defaults() {
|
|
|
388
430
|
// Default options passed to cacheiro for
|
|
389
431
|
// every other cache
|
|
390
432
|
default: {
|
|
391
|
-
type:
|
|
433
|
+
type: process.env.MIOLO_CACHE_TYPE || "combined",
|
|
392
434
|
redis: {
|
|
393
|
-
host:
|
|
394
|
-
|
|
435
|
+
host:
|
|
436
|
+
process.env?.IS_DOCKER === "true"
|
|
437
|
+
? process.env.MIOLO_REDIS_HOSTNAME_DOCKER || "redis"
|
|
438
|
+
: process.env.MIOLO_REDIS_HOSTNAME || "127.0.0.1",
|
|
439
|
+
port: parseInt(process.env.MIOLO_REDIS_PORT || 6379, 10)
|
|
395
440
|
},
|
|
396
|
-
version: parseInt(process.env.MIOLO_CACHE_VERSION || 1),
|
|
397
|
-
clean: false
|
|
441
|
+
version: parseInt(process.env.MIOLO_CACHE_VERSION || 1, 10),
|
|
442
|
+
clean: false
|
|
398
443
|
},
|
|
399
|
-
|
|
444
|
+
|
|
400
445
|
// specific cache options for calustra
|
|
401
446
|
calustra: {
|
|
402
|
-
namespace:
|
|
403
|
-
ttl: parseInt(process.env.MIOLO_CACHE_CALUSTRA_TTL || 86400*1000),
|
|
404
|
-
version: parseInt(
|
|
447
|
+
namespace: "miolo-calustra",
|
|
448
|
+
ttl: parseInt(process.env.MIOLO_CACHE_CALUSTRA_TTL || 86400 * 1000, 10),
|
|
449
|
+
version: parseInt(
|
|
450
|
+
process.env.MIOLO_CACHE_CALUSTRA_VERSION || process.env.MIOLO_CACHE_VERSION || 1,
|
|
451
|
+
10
|
|
452
|
+
)
|
|
405
453
|
},
|
|
406
454
|
|
|
407
455
|
// specific cache options for koa-session
|
|
408
456
|
session: {
|
|
409
|
-
namespace:
|
|
410
|
-
ttl: parseInt(
|
|
411
|
-
|
|
457
|
+
namespace: "miolo-session",
|
|
458
|
+
ttl: parseInt(
|
|
459
|
+
process.env.MIOLO_CACHE_SESSION_TTL ||
|
|
460
|
+
process.env.MIOLO_SESSION_MAX_AGE ||
|
|
461
|
+
SESSION_MAX_AGE,
|
|
462
|
+
10
|
|
463
|
+
),
|
|
464
|
+
version: parseInt(
|
|
465
|
+
process.env.MIOLO_CACHE_SESSION_VERSION || process.env.MIOLO_CACHE_VERSION || 1,
|
|
466
|
+
10
|
|
467
|
+
)
|
|
412
468
|
},
|
|
413
|
-
|
|
469
|
+
|
|
414
470
|
// custom cache instances
|
|
415
471
|
// will be inited by miolo, and available through ctx.miolo.cache.get_cache('name')
|
|
416
472
|
custom: {
|
|
417
|
-
|
|
473
|
+
// <name>: {options}
|
|
418
474
|
}
|
|
419
|
-
|
|
420
|
-
|
|
421
475
|
},
|
|
422
476
|
|
|
423
477
|
socket: {
|
|
424
478
|
enabled: false,
|
|
479
|
+
// Auto create rooms based on sessions
|
|
480
|
+
// To be able to do like: app.context.miolo.io.to('user_<id>').emit('ns', newData);
|
|
481
|
+
userRooms: true,
|
|
425
482
|
cli: {
|
|
426
483
|
/**
|
|
427
|
-
|
|
428
|
-
|
|
484
|
+
url: '',
|
|
485
|
+
options: {}
|
|
429
486
|
*/
|
|
430
487
|
}
|
|
431
488
|
/*
|
|
@@ -439,39 +496,50 @@ export default function make_config_defaults() {
|
|
|
439
496
|
},
|
|
440
497
|
|
|
441
498
|
build: {
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
html:
|
|
499
|
+
client:
|
|
500
|
+
process.env.NODE_ENV === "production"
|
|
501
|
+
? `${process.env.MIOLO_BUILD_CLIENT_DEST || "./build/cli"}/${process.env.MIOLO_NAME || "miolo"}.${process.env.MIOLO_BUILD_CLIENT_SUFFIX || "iife.bundle.min"}.js`
|
|
502
|
+
: process.env.MIOLO_BUILD_CLIENT_ENTRY,
|
|
503
|
+
|
|
504
|
+
html:
|
|
505
|
+
process.env.MIOLO_BUILD_HTML_FILE === "false"
|
|
506
|
+
? ""
|
|
507
|
+
: process.env.MIOLO_BUILD_HTML_FILE || "./src/cli/index.html",
|
|
448
508
|
|
|
449
509
|
vite: {
|
|
450
|
-
base:
|
|
451
|
-
root:
|
|
510
|
+
base: "/",
|
|
511
|
+
root: "",
|
|
452
512
|
watch: {
|
|
453
513
|
// During tests we edit the files too fast and sometimes chokidar
|
|
454
514
|
// misses change events, so enforce polling for consistency
|
|
455
515
|
usePolling: true,
|
|
456
|
-
interval: 100
|
|
457
|
-
},
|
|
516
|
+
interval: 100
|
|
517
|
+
},
|
|
518
|
+
ssr: {
|
|
519
|
+
noExternal: ["miolo-react"]
|
|
520
|
+
}
|
|
458
521
|
},
|
|
459
|
-
|
|
522
|
+
|
|
460
523
|
ssr: {
|
|
461
|
-
server:
|
|
462
|
-
|
|
463
|
-
|
|
524
|
+
server:
|
|
525
|
+
process.env.NODE_ENV === "production"
|
|
526
|
+
? path.join(
|
|
527
|
+
process.cwd(),
|
|
528
|
+
`${process.env.MIOLO_BUILD_SERVER_DEST || "./build/server"}/entry-server.js`
|
|
529
|
+
)
|
|
530
|
+
: process.env.MIOLO_BUILD_SERVER_SSR_ENTRY || "./src/server/ssr/entry-server.jsx"
|
|
464
531
|
// loader: async (ctx) => {}
|
|
465
532
|
},
|
|
466
533
|
|
|
467
534
|
dev: {
|
|
468
535
|
watcher: {
|
|
469
|
-
enabled: process.env.MIOLO_DEV_WATCH_ENABLED===
|
|
470
|
-
dirs:
|
|
471
|
-
|
|
536
|
+
enabled: process.env.MIOLO_DEV_WATCH_ENABLED === "true",
|
|
537
|
+
dirs:
|
|
538
|
+
process.env.MIOLO_DEV_WATCH_DIRS?.split(",")?.map((dir) =>
|
|
539
|
+
path.join(process.cwd(), dir)
|
|
540
|
+
) || []
|
|
541
|
+
}
|
|
472
542
|
}
|
|
473
543
|
}
|
|
474
544
|
}
|
|
475
545
|
}
|
|
476
|
-
|
|
477
|
-
|