LegendaryB
(LegendaryB)
October 28, 2025, 3:25pm
1
Hey guys,
hope I’m in the right section. I use Silverbullet v2.
I have the following data:
First question
Id: 1
Hostname: polaris
Type: VPS
Wireguard-IP: 10.10.10.1
---
Id: 2
Hostname: sirius
Type: Physical
LAN_IP: 192.168.178.101
Wireguard_IP: 10.10.10.101
---
Id: 3
Hostname: vega
Type: Physical
LAN_IP: 192.168.178.102
Wireguard_IP: 10.10.10.102
---
Id: 4
Hostname: regulus
Type: Physical
LAN_IP: 192.168.178.103
Wireguard_IP: 10.10.10.103
---
Id: 5
Hostname: procyon
Type: Physical
LAN_IP: 192.168.178.104
Wireguard_IP: 10.10.10.104
Is it possible to reference for example server 1 in another data definition? I have a services definition and want to reference one of the server definitions. Maybe also with an optional “expand”. Something like this:
Id: 1
Server: @servers[1]
Name: Caddy
Port: "80/443"
Domain:
---
With “expand” I mean that when I look at the data there is no @servers [1] appearing but instead for example the hostname.
Second question
Is it in a query possible to “format” the select property name?
For example:
${query[[
from p = index.tag "servers"
select
{
Id = p.Id,
Hostname = p.Hostname,
LAN_IP = p.LAN_IP
}]]}
This renders a table as expected. But I want to display LAN_IP as LAN IP so without the underscore.
Sorry for all the questions, bet it was asked before but as I said pretty new and blown away from the possibilites. Thank you
Mr.Red
October 28, 2025, 3:47pm
2
starting with the second question(easier):
Try this:
${query[[
from p = index.tag "servers"
select
{
Id = p.Id,
Hostname = p.Hostname,
["LAN IP"] = p.LAN_IP
}]]}
as for the first section first I recommend you separate the server objects each in its own codeblock like this:
Id: 1
Hostname: polaris
Type: VPS
Wireguard_IP: 10.10.10.1
Id: 2
Hostname: sirius
Type: Physical
LAN_IP: 192.168.178.101
Wireguard_IP: 10.10.10.101
Id: 3
Hostname: vega
Type: Physical
LAN_IP: 192.168.178.102
Wireguard_IP: 10.10.10.102
you can reference the first server as it’s hostname like this:
${table.unpack(query[[from index.tag "servers" where Id == 1 select "[[" .. ref.."|"..Hostname.."]]"]])}
But not inside an object definition codeblock only in tables, queries, inline or inside a space-lua script, so as far as I know there is no way to jump from one object definition to another. or I’m not sure I understood your question correctly.
LegendaryB
(LegendaryB)
October 28, 2025, 5:06pm
3
Thank you @Mr.Red , this helps a ton
1 Like
Mr.Red
October 28, 2025, 7:47pm
4
another alternative is to write a space-lua function to exactly do what you want but without repeating the query n-times.
this would look like this?
this is a space lua code block put anywher on any page inside your space:
function server_link(id)
local s = query[[from index.tag "servers" where Id == id]]
return string.format("[[%s|%s]]", s[1].ref, s[1].Hostname)
end
and the simply call it with
${server_link(1)}
here’s a screenshot for this function in action:
LegendaryB
(LegendaryB)
October 28, 2025, 8:08pm
5
Its crazy how I always was to lazy to document my homelab etc. but now feels like I found my place lol. Thank you again, that is even better