@rip-lang/server 1.3.21 → 1.3.23
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/package.json +2 -2
- package/server.rip +6 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rip-lang/server",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.23",
|
|
4
4
|
"description": "Pure Rip web framework and application server",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "api.rip",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"author": "Steve Shreeve <steve.shreeve@gmail.com>",
|
|
46
46
|
"license": "MIT",
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"rip-lang": ">=3.13.
|
|
48
|
+
"rip-lang": ">=3.13.39"
|
|
49
49
|
},
|
|
50
50
|
"files": [
|
|
51
51
|
"api.rip",
|
package/server.rip
CHANGED
|
@@ -125,7 +125,7 @@ logAccessHuman = (app, req, res, totalSeconds, workerSeconds) ->
|
|
|
125
125
|
contentType = (res.headers.get('content-type') or '').split(';')[0] or ''
|
|
126
126
|
sub = if contentType.includes('/') then contentType.split('/')[1] else contentType
|
|
127
127
|
type = (typeAbbrev[sub] or sub or '').padEnd(4)
|
|
128
|
-
console.log "
|
|
128
|
+
console.log "#{timestamp} #{timezone} #{dur} │ #{status} #{type} #{size} │ #{method} #{path}"
|
|
129
129
|
|
|
130
130
|
INTERNAL_HEADERS = new Set(['rip-worker-busy', 'rip-worker-id', 'rip-no-log'])
|
|
131
131
|
|
|
@@ -362,9 +362,6 @@ runSetup = ->
|
|
|
362
362
|
fn = mod?.setup or mod?.default
|
|
363
363
|
if typeof fn is 'function'
|
|
364
364
|
await fn()
|
|
365
|
-
# Send the DB URL to the Manager via IPC (null if rip-db was already running)
|
|
366
|
-
url = if typeof mod?.dbUrl is 'function' then mod.dbUrl() else null
|
|
367
|
-
process.send({ dbUrl: url }) if process.send
|
|
368
365
|
catch e
|
|
369
366
|
console.error "rip-server: setup failed:", e
|
|
370
367
|
process.exit(1)
|
|
@@ -515,6 +512,11 @@ class Manager
|
|
|
515
512
|
# Run one-time setup if setup.rip exists next to the entry file
|
|
516
513
|
setupFile = join(dirname(@flags.appEntry), 'setup.rip')
|
|
517
514
|
if existsSync(setupFile)
|
|
515
|
+
# Check reachability before setup — determines if WE will start the DB
|
|
516
|
+
dbUrl = process.env.DB_URL or 'http://localhost:4213'
|
|
517
|
+
dbAlreadyRunning = await (try fetch(dbUrl + '/health').then(-> true) catch -> false)
|
|
518
|
+
@dbUrl = dbUrl unless dbAlreadyRunning
|
|
519
|
+
|
|
518
520
|
setupEnv = Object.assign {}, process.env,
|
|
519
521
|
RIP_SETUP_MODE: '1'
|
|
520
522
|
RIP_SETUP_FILE: setupFile
|
|
@@ -524,7 +526,6 @@ class Manager
|
|
|
524
526
|
stdin: 'ignore'
|
|
525
527
|
cwd: process.cwd()
|
|
526
528
|
env: setupEnv
|
|
527
|
-
ipc: (msg) => @dbUrl = msg.dbUrl if msg?.dbUrl
|
|
528
529
|
|
|
529
530
|
code = await proc.exited
|
|
530
531
|
if code isnt 0
|
|
@@ -717,7 +718,6 @@ class Manager
|
|
|
717
718
|
return if @shuttingDown
|
|
718
719
|
@shuttingDown = true
|
|
719
720
|
@stop!
|
|
720
|
-
# Shutdown rip-db if we launched it — HTTP call, clean WAL checkpoint
|
|
721
721
|
try fetch!(@dbUrl + '/shutdown', { method: 'POST' }) if @dbUrl catch then null
|
|
722
722
|
process.exit(0)
|
|
723
723
|
|