diff --git a/.drone.status b/.drone.status deleted file mode 100644 index 259788f..0000000 --- a/.drone.status +++ /dev/null @@ -1,3 +0,0 @@ -{ - "url": "https://drone.hibas123.de/OpenServer/OpenAuth_server/" -} \ No newline at end of file diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 21415c1..0000000 --- a/.drone.yml +++ /dev/null @@ -1,21 +0,0 @@ -kind: pipeline -type: docker -name: default - -steps: - - name: Build docker - image: plugins/docker - settings: - username: - from_secret: docker_username - password: - from_secret: docker_password - auto_tag: true - repo: docker.hibas123.de/authserver - registry: docker.hibas123.de - debug: true - when: - branch: [master] - event: - exclude: - - pull_request diff --git a/Backend/.dockerignore b/Backend/.dockerignore new file mode 100644 index 0000000..3507a4c --- /dev/null +++ b/Backend/.dockerignore @@ -0,0 +1 @@ +config.ini \ No newline at end of file diff --git a/Backend/src/config.ts b/Backend/src/config.ts index 576020c..9f95238 100644 --- a/Backend/src/config.ts +++ b/Backend/src/config.ts @@ -10,6 +10,8 @@ dotenv.config(); export interface DatabaseConfig { host: string; database: string; + username?: string; + password?: string; } export interface WebConfig { @@ -57,6 +59,14 @@ const config = (parse( type: String, default: "localhost", }, + username: { + type: String, + optional: true, + }, + password: { + type: String, + optional: true, + }, }, web: { port: { diff --git a/Backend/src/database.ts b/Backend/src/database.ts index 64d84d9..b709884 100644 --- a/Backend/src/database.ts +++ b/Backend/src/database.ts @@ -7,7 +7,16 @@ if (Config.database) { if (Config.database.host) host = Config.database.host; } if (Config.core.dev) dbname += "_dev"; -const DB = new SafeMongo("mongodb://" + host, dbname, { +let auth = undefined; +if (Config.database.username) { + auth = { + username: Config.database.username, + password: Config.database.password + } +} + +const DB = new SafeMongo("mongodb://" + host, dbname, { + auth }); export default DB; diff --git a/Earthfile b/Earthfile index 4d8e1e4..b7543f1 100644 --- a/Earthfile +++ b/Earthfile @@ -11,6 +11,7 @@ build: RUN yarn build + SAVE ARTIFACT /build/_API /API SAVE ARTIFACT /build/Backend/lib /Backend SAVE ARTIFACT /build/Frontend/build /Frontend SAVE ARTIFACT /build/FrontendLegacy/out /FrontendLegacy @@ -26,6 +27,7 @@ docker: # COPY ./supervisord.conf /etc/supervisord.conf + COPY +build/API /build/_API COPY +build/Backend /build/Backend/lib COPY +build/Frontend /build/Frontend/build COPY +build/FrontendLegacy /build/FrontendLegacy/out diff --git a/Frontend/package.json b/Frontend/package.json index 5434d7a..6c53587 100644 --- a/Frontend/package.json +++ b/Frontend/package.json @@ -2,18 +2,25 @@ "name": "@hibas123/openauth-views-v2", "main": "index.js", "devDependencies": { + "@hibas123/openauth-internalapi": "workspace:^", + "@hibas123/theme": "^2.0.6", + "@hibas123/utils": "^2.2.18", "@popperjs/core": "^2.11.7", + "@rollup/plugin-commonjs": "^24.0.1", "@rollup/plugin-html": "^1.0.2", "@rollup/plugin-image": "^3.0.2", "@rollup/plugin-node-resolve": "^15.0.2", + "@simplewebauthn/browser": "^7.2.0", "@tsconfig/svelte": "^4.0.1", "@types/cleave.js": "^1.4.7", "autoprefixer": "^10.4.14", "classnames": "^2.3.2", + "cleave.js": "^1.6.0", "cssnano": "^6.0.0", "esbuild": "^0.17.16", "flowbite": "^1.6.5", "flowbite-svelte": "^0.34.9", + "joi": "^17.9.1", "postcss": "^8.4.21", "postcss-import": "^15.1.0", "postcss-url": "^10.1.3", @@ -28,21 +35,12 @@ "svelte": "^3.58.0", "svelte-preprocess": "^5.0.3", "tailwindcss": "^3.3.1", - "typescript": "^5.0.4" + "typescript": "^5.0.4", + "what-the-pack": "^2.0.3" }, "scripts": { "prepublishOnly": "npm run build", "build": "rollup -c rollup.config.mjs ", "dev": "rollup -c rollup.config.mjs -w" - }, - "dependencies": { - "@hibas123/openauth-internalapi": "workspace:^", - "@hibas123/theme": "^2.0.6", - "@hibas123/utils": "^2.2.18", - "@rollup/plugin-commonjs": "^24.0.1", - "@simplewebauthn/browser": "^7.2.0", - "cleave.js": "^1.6.0", - "joi": "^17.9.1", - "what-the-pack": "^2.0.3" } }