@rip-lang/server 1.3.33 → 1.3.35
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/README.md +15 -1
- package/package.json +2 -2
- package/server.rip +14 -14
package/README.md
CHANGED
|
@@ -1037,13 +1037,27 @@ migrations, table creation, and seeding.
|
|
|
1037
1037
|
export setup = ->
|
|
1038
1038
|
await createTables()
|
|
1039
1039
|
await seedData()
|
|
1040
|
-
|
|
1040
|
+
p 'Database ready'
|
|
1041
1041
|
```
|
|
1042
1042
|
|
|
1043
1043
|
The setup function can export as `setup` or `default`. If the file doesn't
|
|
1044
1044
|
exist, the setup phase is skipped entirely (no overhead). If setup fails,
|
|
1045
1045
|
the server exits immediately.
|
|
1046
1046
|
|
|
1047
|
+
When `setup.rip` is present, the `rip-server: https://...` URL lines are
|
|
1048
|
+
**suppressed at the top** of the output — they will appear later via `[setup]`
|
|
1049
|
+
instead, after migrations complete. The actual server URLs are passed to the
|
|
1050
|
+
setup process as `process.env.RIP_URLS` (comma-separated), so you can display
|
|
1051
|
+
them exactly as rip-server computed them:
|
|
1052
|
+
|
|
1053
|
+
```coffee
|
|
1054
|
+
# setup.rip — print URLs at the bottom after setup completes
|
|
1055
|
+
export setup = ->
|
|
1056
|
+
await runMigrations()
|
|
1057
|
+
urls = process.env.RIP_URLS?.split(',') or []
|
|
1058
|
+
p "[setup] #{urls.join(' | ')}"
|
|
1059
|
+
```
|
|
1060
|
+
|
|
1047
1061
|
## Environment Variables
|
|
1048
1062
|
|
|
1049
1063
|
Most settings are configured via CLI flags, but environment variables provide an alternative for containers, CI/CD, or system-wide defaults.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rip-lang/server",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.35",
|
|
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.52"
|
|
49
49
|
},
|
|
50
50
|
"files": [
|
|
51
51
|
"api.rip",
|
package/server.rip
CHANGED
|
@@ -737,6 +737,7 @@ class Server
|
|
|
737
737
|
@availableWorkers = []
|
|
738
738
|
@inflightTotal = 0
|
|
739
739
|
@queue = []
|
|
740
|
+
@urls = []
|
|
740
741
|
@startedAt = nowMs()
|
|
741
742
|
@newestVersion = null
|
|
742
743
|
@httpsActive = false
|
|
@@ -1026,7 +1027,9 @@ class Server
|
|
|
1026
1027
|
|
|
1027
1028
|
port = @flags.httpsPort or @flags.httpPort or 80
|
|
1028
1029
|
protocol = if @flags.httpsPort then 'https' else 'http'
|
|
1029
|
-
|
|
1030
|
+
url = "#{protocol}://#{@flags.appName}.ripdev.io#{formatPort(protocol, port)}"
|
|
1031
|
+
@urls.push(url)
|
|
1032
|
+
p "rip-server: #{url}" unless @flags.quiet or @flags.hideUrls
|
|
1030
1033
|
|
|
1031
1034
|
controlFetch: (req) ->
|
|
1032
1035
|
url = new URL(req.url)
|
|
@@ -1148,7 +1151,9 @@ class Server
|
|
|
1148
1151
|
stderr: 'ignore'
|
|
1149
1152
|
|
|
1150
1153
|
@mdnsProcesses.set(host, proc)
|
|
1151
|
-
|
|
1154
|
+
url = "#{protocol}://#{host}#{formatPort(protocol, port)}"
|
|
1155
|
+
@urls.push(url)
|
|
1156
|
+
p "rip-server: #{url}" unless @flags.quiet or @flags.hideUrls
|
|
1152
1157
|
catch e
|
|
1153
1158
|
console.error "rip-server: failed to advertise #{host} via mDNS:", e.message
|
|
1154
1159
|
|
|
@@ -1293,21 +1298,16 @@ main = ->
|
|
|
1293
1298
|
console.error 'rip-server: unhandled rejection:', err
|
|
1294
1299
|
cleanup()
|
|
1295
1300
|
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
portStr = formatPort(protocol, port)
|
|
1300
|
-
appUrls = flags.appAliases.map (alias) ->
|
|
1301
|
-
host = if alias.includes('.') then alias else "#{alias}.local"
|
|
1302
|
-
"#{protocol}://#{host}#{portStr}"
|
|
1303
|
-
process.env.RIP_URLS = [
|
|
1304
|
-
"#{protocol}://rip.local#{portStr}"
|
|
1305
|
-
...appUrls
|
|
1306
|
-
"#{protocol}://#{flags.appName}.ripdev.io#{portStr}"
|
|
1307
|
-
].join(',')
|
|
1301
|
+
# Suppress top URL lines if setup.rip will print them at the bottom
|
|
1302
|
+
setupFile = join(dirname(flags.appEntry), 'setup.rip')
|
|
1303
|
+
flags.hideUrls = existsSync(setupFile)
|
|
1308
1304
|
|
|
1309
1305
|
svr.start!
|
|
1306
|
+
process.env.RIP_URLS = svr.urls.join(',') # exact URLs the Server just built
|
|
1310
1307
|
mgr.start!
|
|
1308
|
+
|
|
1309
|
+
httpOnly = flags.httpsPort is null
|
|
1310
|
+
protocol = if httpOnly then 'http' else 'https'
|
|
1311
1311
|
port = flags.httpsPort or flags.httpPort or 80
|
|
1312
1312
|
console.log "rip-server: app=#{flags.appName} workers=#{flags.workers} url=#{protocol}://#{flags.appName}.ripdev.io#{formatPort(protocol, port)}/server"
|
|
1313
1313
|
|