Commit 63a865fc authored by Panagiotis Skarvelis's avatar Panagiotis Skarvelis 🤔
Browse files

add basic authentication

parent 11919b0f
......@@ -5,4 +5,6 @@ COPY ./package.json /package.json
COPY editor.ts /editor.ts
COPY swagger.yaml /swagger.yaml
RUN yarn install
#need to do that cause ive get the openapi-editor from external repo
RUN cd node_modules/openapi-editor&&yarn install&&yarn build&&cd /
CMD ["yarn", "start"]
......@@ -7,7 +7,7 @@ A swagger editor that rocks. Can save the editing swagger file server-side and a
## Run
`docker run -d -v ${PWD}/swagger.yaml:/swagger.yaml -p 8631:8631 openapicloudeditor`
`docker run --rm -d -e BASICAUTH="editor:password" -v ${PWD}/swagger.yaml:/swagger.yaml -p 8631:8631 openapicloudeditor`
* you can override the file name of swagger.yaml using the enviroment5 variable `SWAGGERFILE`
......@@ -7,7 +7,10 @@ const options:Options = {
port: "8631", // specify port or omit for random port usage
silent: true, // invoque browser or run silently
};
if (process.env.BASICAUTH) options.basicAuth = process.env.BASICAUTH
openApiEditor(options);
} else {
console.error("No swagger file specified");
}
\ No newline at end of file
{
"name": "openapi-cloud-editor",
"private":"true",
"private": "true",
"description": "A swagger editor with server side save and password protected access",
"authors": "Panagiotis Skarvelis <pskarvelis@admin.grnet.gr>",
"version": "1.0.0",
"main": "editor.ts",
"dependencies": {
"openapi-editor":"*",
"express-basic-auth":"*"
"openapi-editor": "https://github.com/sl45sms/openapi-editor.git"
},
"devDependencies": {
"@types/node": "17.0.21",
"ts-node":"^10.7.0",
"typescript":"^4.1.3"
"ts-node": "^10.7.0",
"typescript": "^4.1.3"
},
"scripts": {
"start": "node --experimental-specifier-resolution=node --experimental-modules --no-warnings --loader ts-node/esm ./editor.ts"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment