Skip to content

Commit 2c9bec5

Browse files
committed
Fix YAML schema inconsistencies
- examples: stop_grace_period was 10 (= 10ns); change to 10000000000 with "10s (nanoseconds)" comment to match the convention #109 established for health_check durations. - mounts.readonly -> mounts.read_only for snake_case consistency with the rest of the schema and Docker Compose. BREAKING. - Configs File.Mode 0 -> 0o444 to match Docker Compose's default for config file permissions.
1 parent 85c619b commit 2c9bec5

4 files changed

Lines changed: 7 additions & 7 deletions

File tree

examples/swarm-app.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ service_specs:
4646
- shared
4747
replicas: 2
4848
stop_signal: SIGQUIT
49-
stop_grace_period: 10
49+
stop_grace_period: 10000000000 # 10s (nanoseconds)
5050
user: '0'
5151
dir: /etc/nginx
5252
placement:
@@ -72,4 +72,4 @@ service_specs:
7272
/etc/nginx/:
7373
source: "web-data"
7474
type: "volume" # "bind|volume"
75-
readonly: true
75+
read_only: true

schema.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@
171171
"bind"
172172
]
173173
},
174-
"readonly": {
174+
"read_only": {
175175
"type": "boolean"
176176
}
177177
}

src/service-spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export function initServiceSpec ({appName, serviceName, config, hashedConfigs, c
4747
if (byServiceName.length > 0) {
4848
configs = byServiceName.map(({targetPath, hash}) => {
4949
return {
50-
File: {Name: targetPath, UID: "0", GID: "0", Mode: 0},
50+
File: {Name: targetPath, UID: "0", GID: "0", Mode: 0o444},
5151
ConfigID: current?.configs.find((c) => c.Spec?.Name === hash)?.ID,
5252
ConfigName: hash,
5353
};
@@ -94,7 +94,7 @@ export function initServiceSpec ({appName, serviceName, config, hashedConfigs, c
9494
Target: t,
9595
Source: m.source,
9696
Type: m.type,
97-
ReadOnly: m.readonly,
97+
ReadOnly: m.read_only,
9898
};
9999
}),
100100
},

src/swarm-app-config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export interface SwarmAppServiceConfig {
5757
mounts?: Record<string, {
5858
source: string;
5959
type: "bind" | "volume";
60-
readonly: boolean;
60+
read_only: boolean;
6161
}>;
6262
update_config?: {
6363
parallelism: number;
@@ -151,7 +151,7 @@ export const swarmAppConfigSchema: JTDSchemaType<SwarmAppConfig> = {
151151
properties: {
152152
source: {type: "string"},
153153
type: {enum: ["volume", "bind"]},
154-
readonly: {type: "boolean"},
154+
read_only: {type: "boolean"},
155155
},
156156
},
157157
},

0 commit comments

Comments
 (0)