as-services/libs/common/oapi/spec-openapi/index.js
devthejo d5febb45c8
Some checks failed
/ build (map[dockerfile:./services/tasks/Dockerfile name:tasks]) (push) Failing after 1m25s
/ deploy (push) Has been skipped
/ build (map[dockerfile:./services/files/Dockerfile name:files]) (push) Failing after 1m34s
/ build (map[dockerfile:./services/app/Dockerfile name:app]) (push) Successful in 2m9s
/ build (map[dockerfile:./services/api/Dockerfile name:api]) (push) Failing after 1m42s
/ build (map[dockerfile:./services/web/Dockerfile name:web]) (push) Failing after 1m18s
/ build (map[dockerfile:./services/watchers/Dockerfile name:watchers]) (push) Failing after 1m22s
/ build (map[dockerfile:./services/hasura/Dockerfile name:hasura]) (push) Successful in 2m3s
chore(init): available sources
2025-04-13 10:34:01 +02:00

57 lines
1.2 KiB
JavaScript

const createOptions = require("utils/schema/options")
const optionsSchema = createOptions({
defaults: {
protocol: "http",
host: "0.0.0.0",
port: 4000,
path: "/",
},
})
async function createApiSpecV1(options = {}) {
optionsSchema(options)
if (process.env.EXTERNAL_PROTOCOL) {
options.protocol = process.env.EXTERNAL_PROTOCOL
}
if (process.env.EXTERNAL_HOST) {
options.host = process.env.EXTERNAL_HOST
}
if (process.env.EXTERNAL_PORT) {
options.port = process.env.EXTERNAL_PORT
}
const apiSpec = {
openapi: "3.0.3",
info: {
title: "HelpMe Project API",
version: "1.0.0",
description: "HelpMe Project OpenAPI 3.",
license: {
name: "DEF",
url: "https://devthefuture.org/DEF-LICENSE.md",
},
contact: {
name: "Jo",
email: "jo@devthefuture.org",
// url: "https://",
},
},
servers: [
{
// description: "Server",
url: `${options.protocol}://${options.host}:${options.port}${options.path}`,
},
],
components: {
schemas: {},
},
paths: {},
"x-security-sets": {
auth: ["bearerAuth", "cookieAuth"],
},
}
return apiSpec
}
module.exports = createApiSpecV1