Repository navigation
Expand file tree
/
Copy pathscriptfs-module.schema.json
More file actions
209 lines (209 loc) · 6.81 KB
/
Copy pathscriptfs-module.schema.json
File metadata and controls
209 lines (209 loc) · 6.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "scriptfs module manifest",
"description": "Describes a ScriptFS module: its entry point and the host resources it needs inside the container.",
"type": "object",
"required": ["name", "entry"],
"properties": {
"$schema": {
"type": "string"
},
"name": {
"type": "string",
"pattern": "^\\S+$",
"description": "Module name, shown in errors and logs."
},
"version": {
"type": "string"
},
"description": {
"type": "string"
},
"entry": {
"type": "string",
"minLength": 1,
"description": "JavaScript entry file relative to this manifest. It must stay inside the module directory."
},
"export": {
"type": "string",
"minLength": 1,
"default": "default",
"description": "Export of the entry file to use: a class constructed with the module runtime, or a provider object."
},
"settings": {
"type": "object",
"description": "Non-secret configuration values. Instances set them under modules.<name>.settings.",
"propertyNames": {
"pattern": "^[A-Za-z][A-Za-z0-9_-]*$",
"description": "Letters, digits, _ and -; starts with a letter."
},
"additionalProperties": {
"type": "object",
"required": ["type"],
"properties": {
"type": {
"enum": [
"string",
"number",
"integer",
"boolean",
"array",
"object"
]
},
"description": {
"type": "string"
},
"default": {
"description": "Value used when the instance does not set the setting."
},
"required": {
"type": "boolean",
"default": false,
"description": "Whether instances must set a value when there is no default."
},
"enum": {
"type": "array",
"minItems": 1,
"description": "Allowed values."
}
},
"additionalProperties": false
}
},
"secrets": {
"type": "object",
"description": "Sensitive values read on the host when the session starts and handed to the module without being written to the configuration.",
"propertyNames": {
"pattern": "^[A-Za-z][A-Za-z0-9_-]*$",
"description": "Letters, digits, _ and -; starts with a letter."
},
"additionalProperties": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"required": {
"type": "boolean",
"default": true
},
"env": {
"type": "string",
"pattern": "^[A-Za-z_][A-Za-z0-9_]*$",
"description": "Environment variable read when the instance does not configure a source."
}
},
"additionalProperties": false
}
},
"ports": {
"type": "object",
"description": "Network connections between the module and the host.",
"propertyNames": {
"pattern": "^[A-Za-z][A-Za-z0-9_-]*$",
"description": "Letters, digits, _ and -; starts with a letter."
},
"additionalProperties": {
"oneOf": [
{
"type": "object",
"description": "The module connects to a service on the host through a ScriptFS tunnel.",
"required": ["direction"],
"properties": {
"direction": {
"const": "outbound"
},
"description": {
"type": "string"
},
"target": {
"type": "string",
"pattern": "^(\\[[^\\]]+\\]|[^:\\s]+):[0-9]{1,5}$",
"description": "Default host:port on the host. Instances can override it."
}
},
"additionalProperties": false
},
{
"type": "object",
"description": "The module listens in the container; the port is published on 127.0.0.1 of the host.",
"required": ["direction", "port"],
"properties": {
"direction": {
"const": "inbound"
},
"description": {
"type": "string"
},
"port": {
"type": "integer",
"minimum": 1,
"maximum": 65535,
"description": "Container port the module listens on."
},
"hostPort": {
"type": "integer",
"minimum": 1,
"maximum": 65535,
"description": "Default host port. Defaults to port; instances can override it."
}
},
"additionalProperties": false
}
]
}
},
"paths": {
"type": "object",
"description": "Host files or directories mounted into the container.",
"propertyNames": {
"pattern": "^[A-Za-z][A-Za-z0-9_-]*$",
"description": "Letters, digits, _ and -; starts with a letter."
},
"additionalProperties": {
"type": "object",
"properties": {
"description": {
"type": "string"
},
"type": {
"enum": ["directory", "file"],
"default": "directory"
},
"access": {
"enum": ["read-only", "read-write"],
"default": "read-only"
},
"required": {
"type": "boolean",
"default": true,
"description": "Optional paths are skipped when they are not configured and their default does not exist."
},
"default": {
"type": "string",
"pattern": "^(/|~/|~$)",
"description": "Host path used when the instance does not configure one: absolute or starting with ~/."
},
"target": {
"type": "string",
"pattern": "^/",
"description": "Container path. Defaults to /scriptfs/paths/<instance>/<key>."
}
},
"additionalProperties": false
}
},
"state": {
"type": "boolean",
"default": false,
"description": "Whether the module gets a persistent, writable state directory."
},
"dependencies": {
"enum": ["bundled", "install"],
"default": "bundled",
"description": "How npm dependencies reach the container. \"bundled\": the module directory already contains everything it imports. \"install\": ScriptFS runs `npm ci --omit=dev --omit=peer` inside the runtime image from the module's package.json and npm-shrinkwrap.json or package-lock.json, caches the result, and mounts it as the module's node_modules."
}
},
"additionalProperties": false
}