@rip-lang/server 0.7.5 → 0.7.7

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/server.rip +10 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rip-lang/server",
3
- "version": "0.7.5",
3
+ "version": "0.7.7",
4
4
  "description": "Pure Rip application server — multi-worker, hot reload, HTTPS, mDNS",
5
5
  "type": "module",
6
6
  "main": "server.rip",
package/server.rip CHANGED
@@ -615,6 +615,11 @@ class Server
615
615
  @httpsActive = false
616
616
  @hostRegistry = new Set(['localhost', '127.0.0.1', 'rip.local'])
617
617
  @mdnsProcesses = new Map()
618
+ try
619
+ pkg = JSON.parse(readFileSync(import.meta.dir + '/package.json', 'utf8'))
620
+ @serverVersion = pkg.version
621
+ catch
622
+ @serverVersion = 'unknown'
618
623
 
619
624
  for alias in @flags.appAliases
620
625
  host = if alias.includes('.') then alias else "#{alias}.local"
@@ -728,13 +733,16 @@ class Server
728
733
  status: ->
729
734
  uptime = Math.floor((nowMs() - @startedAt) / 1000)
730
735
  healthy = @sockets.length > 0
736
+ hosts = Array.from(@hostRegistry.values())
737
+ version = @serverVersion
731
738
  body = JSON.stringify
732
739
  status: if healthy then 'healthy' else 'degraded'
740
+ version: version
733
741
  app: @flags.appName
734
742
  workers: @sockets.length
735
743
  ports: { http: @flags.httpPort or undefined, https: @flags.httpsPort or undefined }
736
- uptime
737
- hosts: Array.from(@hostRegistry.values())
744
+ uptime: uptime
745
+ hosts: hosts
738
746
  headers = new Headers({ 'content-type': 'application/json', 'cache-control': 'no-cache' })
739
747
  @maybeAddSecurityHeaders(headers)
740
748
  new Response(body, { headers })