engine: resources: Add the proper prefix to grouped http resources

Resources that can be grouped into the http:server resource must have
that prefix. Grouping is basically hierarchical, and without that common
prefix, it means we'd have to special-case our grouping algorithm.
This commit is contained in:
James Shubin
2025-05-25 01:40:25 -04:00
parent 1f54253f95
commit 654e958d3f
35 changed files with 1513 additions and 1413 deletions

View File

@@ -6,12 +6,12 @@ http:server ":8080" { # by default http uses :80 but using :8080 avoids needing
}
# you can add a raw file like this...
http:file "/file1" {
http:server:file "/file1" {
data => "hello, world, i'm file1 and i don't exist on disk!\n",
}
# wget --post-data 'key=hello&whatever=bye' -O - http://127.0.0.1:8080/flag1
http:flag "/flag1" {
http:server:flag "/flag1" {
#server => ":8080",
key => "key",
}
@@ -22,8 +22,8 @@ print "print1" {
Meta:autogroup => false,
}
Http:Flag["/flag1"].value -> Print["print1"].msg
Http:Flag["/flag1"].value -> Value["value1"].any
Http:Server:Flag["/flag1"].value -> Print["print1"].msg
Http:Server:Flag["/flag1"].value -> Value["value1"].any
$ret = value.get_str("value1") # name of value resource
$val = $ret->value

View File

@@ -4,7 +4,7 @@ http:server ":8080" { # by default http uses :80 but using :8080 avoids needing
}
# you can add a raw file like this...
http:file "/file1" {
http:server:file "/file1" {
data => "hello, world, i'm file1 and i don't exist on disk!\n",
}
@@ -17,7 +17,7 @@ file "${distroarch_http_prefix}" { # root http dir
}
# this one is backed by the (optional) rsync
#http:file "/fedora/releases/${version}/Everything/${arch}/os/" {
#http:server:file "/fedora/releases/${version}/Everything/${arch}/os/" {
# path => "${distroarch_http_prefix}",
#}
@@ -25,7 +25,7 @@ file "${distroarch_http_prefix}" { # root http dir
# wget http://127.0.0.1:8080/fedora/releases/38/Everything/x86_64/os/Packages/c/cowsay-3.7.0-7.fc38.noarch.rpm
# wget https://mirrors.xtom.de/fedora/releases/38/Everything/x86_64/os/Packages/c/cowsay-3.7.0-7.fc38.noarch.rpm
http:proxy "/fedora/releases/${version}/Everything/${arch}/os/" { # same as the http:file path
http:server:proxy "/fedora/releases/${version}/Everything/${arch}/os/" { # same as the http:server:file path
cache => "${distroarch_http_prefix}", # /tmp/os/
#force => false, # if true, overwrite or change from dir->file if needed

View File

@@ -5,11 +5,11 @@ http:server ":8080" { # by default http uses :80 but using :8080 avoids needing
}
# you can add a raw file like this...
http:file "/file1" {
http:server:file "/file1" {
data => "hello, world, i'm file1 and i don't exist on disk!\n",
}
http:ui "/ui/" {
http:server:ui "/ui/" {
#path => "/ui/", # we can override the name like this if needed
data => struct{
@@ -20,18 +20,18 @@ http:ui "/ui/" {
$text1_id = "text1"
$range1_id = "range1"
http:ui:input $text1_id {
http:server:ui:input $text1_id {
store => "world://",
sort => "a",
}
http:ui:input $range1_id {
http:server:ui:input $range1_id {
store => "world://",
type => "range://?min=0&max=5&step=1",
sort => "b",
}
#Http:Ui:Input[$text1_id].value -> Kv[$text1_id].value
#Http:Server:Ui:Input[$text1_id].value -> Kv[$text1_id].value
#kv $text1_id { # store in world
#}

View File

@@ -5,11 +5,11 @@ http:server ":8080" { # by default http uses :80 but using :8080 avoids needing
}
# you can add a raw file like this...
http:file "/file1" {
http:server:file "/file1" {
data => "hello, world, i'm file1 and i don't exist on disk!\n",
}
http:ui "/ui/" {
http:server:ui "/ui/" {
#path => "/ui/", # we can override the name like this if needed
data => struct{
@@ -30,17 +30,17 @@ $range1_val = if $ret2->ready {
} else {
"2" # some default
}
http:ui:input $text1_id {
http:server:ui:input $text1_id {
value => $text1_val, # it passes back into itself!
}
http:ui:input $range1_id {
http:server:ui:input $range1_id {
value => $range1_val,
type => "range://?min=0&max=5&step=1",
sort => "b",
}
Http:Ui:Input[$text1_id].value -> Value[$text1_id].any
Http:Server:Ui:Input[$text1_id].value -> Value[$text1_id].any
value $text1_id {
any => "whatever", # TODO: remove the temporary placeholder here

View File

@@ -14,7 +14,7 @@ http:server ":8080" { # by default http uses :80 but using :8080 avoids needing
}
# you can add a raw file like this...
http:file "/file1" {
http:server:file "/file1" {
data => "hello, world, i'm file1 and i don't exist on disk!\n",
}
@@ -26,19 +26,19 @@ file $f2 {
}
# you can point to it directly...
http:file "/file2" {
http:server:file "/file2" {
path => $f2,
Depend => File[$f2], # TODO: add autoedges
}
# here's a file in the middle of nowhere that still works...
http:file "/i/am/some/deeply/nested/file" {
http:server:file "/i/am/some/deeply/nested/file" {
data => "how did you find me!\n",
}
# and this file won't autogroup with the main http server
http:file "/nope/noway" {
http:server:file "/nope/noway" {
data => "i won't be seen!\n",
server => "someone else!", # normally we don't use this this way
}

View File

@@ -34,12 +34,12 @@ http:server ":8080" { # by default http uses :80 but using :8080 avoids needing
}
# you can add a raw file like this...
http:file "/file1" {
http:server:file "/file1" {
data => "hello, world, i'm file1 and i don't exist on disk!\n",
}
# this pulls in a whole folder, since path is a folder!
http:file "/secret/folder/" {
http:server:file "/secret/folder/" {
path => "${root}",
Depend => File["${root}"], # TODO: add autoedges