fix couchdb configs
Deploy service couchdb / service couchdb (push) Successful in 32s
Deploy db-migrations / db-migrations (push) Successful in 59s

This commit is contained in:
2024-12-06 11:57:07 +02:00
parent 7f27948d79
commit d8fd872478
2 changed files with 1 additions and 36 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
FROM couchdb:latest
HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=5 CMD curl --fail http://localhost:5984 || exit 1
COPY ./config/* /opt/couchdb/etc/local.d/*
COPY ./config/* /opt/couchdb/etc/local.d/
@@ -79,41 +79,6 @@ export const up = async () => {
);
}
}
const corsConfig = {
"chttpd/enable_cors": "true",
"cors/origins": "*",
"cors/credentials": "true",
"cors/methods": "GET, PUT, POST, HEAD, DELETE",
"cors/headers":
"accept, authorization, content-type, origin, referer, x-csrf-token",
};
const membership = await fetch(getUrl("_membership"), { headers }).then(
(response) => response.json(),
);
if (!membership || membership.error) {
throw new Error(`_membership error ${JSON.stringify(membership)}`);
}
for (const node of membership.cluster_nodes) {
for (const [configPath, value] of Object.entries(corsConfig)) {
const corsURL = `_node/${node}/_config/${configPath}`;
const response = await fetch(getUrl(corsURL), {
method: "PUT",
headers,
body: JSON.stringify(value),
}).then((response) => response.json());
if (!response.error) {
console.log(`set ${configPath} ${response}`);
} else {
throw new Error(
`${corsURL} set ${value} error ${JSON.stringify(response)}`,
);
}
}
}
};
export const down = async () => {