Compare commits
20 Commits
fd5aa79278
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| af0e2919f4 | |||
| beea84a6e9 | |||
| b6570b2385 | |||
| d514029e5a | |||
| 086db87972 | |||
| e90bf240e8 | |||
| 3a56a6b892 | |||
| 6c176b3cdb | |||
| b97c2f7fbc | |||
| 13a5edc9ac | |||
| 12e4b46761 | |||
| 3d911448c4 | |||
| 4f012b6b52 | |||
| fd6ffabb89 | |||
| 02401550fc | |||
| 9e8f21ff68 | |||
| f793bc957b | |||
| db82158cc1 | |||
| 14d846a456 | |||
| af0d3d2c53 |
50
.gitea/workflows/build-docker-container.yml
Normal file
50
.gitea/workflows/build-docker-container.yml
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
name: build-docker-imge
|
||||||
|
on:
|
||||||
|
- push
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build the docker container
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: "Git clone"
|
||||||
|
run: git clone ${{ gitea.server_url }}/${{ gitea.repository }}.git .
|
||||||
|
- name: "LS"
|
||||||
|
run: ls -lisa
|
||||||
|
- name: "LS ECHO"
|
||||||
|
run: echo "$(ls)" "${{ gitea.repository }}" "${{ gitea.ref_name }}" "${{ gitea.sha }}"
|
||||||
|
- name: "Git checkout"
|
||||||
|
run: git checkout "${{ gitea.sha }}"
|
||||||
|
- uses: aevea/action-kaniko@master
|
||||||
|
name: Run Kaniko to build our api docker container.
|
||||||
|
with:
|
||||||
|
image: kocoded/nachhilfesystem/api
|
||||||
|
tag: ${{ git.workflow_sha }}
|
||||||
|
tag_with_latest: github.ref == 'refs/heads/master'
|
||||||
|
registry: git.kocoder.xyz
|
||||||
|
username: ${{ secrets.CI_RUNNER_USER }}
|
||||||
|
password: ${{ secrets.CI_RUNNER_TOKEN }}
|
||||||
|
build_file: Dockerfile
|
||||||
|
target: api_serve
|
||||||
|
- uses: aevea/action-kaniko@master
|
||||||
|
name: Run Kaniko to build our web docker container.
|
||||||
|
with:
|
||||||
|
image: kocoded/nachhilfesystem/web
|
||||||
|
tag: ${{ git.workflow_sha }}
|
||||||
|
tag_with_latest: github.ref == 'refs/heads/master'
|
||||||
|
registry: git.kocoder.xyz
|
||||||
|
username: ${{ secrets.CI_RUNNER_USER }}
|
||||||
|
password: ${{ secrets.CI_RUNNER_TOKEN }}
|
||||||
|
build_file: Dockerfile
|
||||||
|
target: web_serve
|
||||||
|
- uses: aevea/action-kaniko@master
|
||||||
|
name: Run Kaniko to build our console docker container.
|
||||||
|
with:
|
||||||
|
image: kocoded/nachhilfesystem/console
|
||||||
|
tag: ${{ git.workflow_sha }}
|
||||||
|
tag_with_latest: github.ref == 'refs/heads/master'
|
||||||
|
registry: git.kocoder.xyz
|
||||||
|
username: ${{ secrets.CI_RUNNER_USER }}
|
||||||
|
password: ${{ secrets.CI_RUNNER_TOKEN }}
|
||||||
|
build_file: Dockerfile
|
||||||
|
target: console
|
||||||
925
.yarn/releases/yarn-4.4.0.cjs
vendored
Executable file
925
.yarn/releases/yarn-4.4.0.cjs
vendored
Executable file
File diff suppressed because one or more lines are too long
10
.yarnrc.yml
10
.yarnrc.yml
@ -1,15 +1,9 @@
|
|||||||
# Yarn's manifest file. You can configure yarn here.
|
|
||||||
# See https://yarnpkg.com/configuration/yarnrc.
|
|
||||||
|
|
||||||
# For `node_modules` (see `nodeLinker` below), this is almost always the preferred option.
|
|
||||||
compressionLevel: 0
|
compressionLevel: 0
|
||||||
|
|
||||||
enableGlobalCache: true
|
enableGlobalCache: true
|
||||||
|
|
||||||
# Lets yarn use hardlinks inside `node_modules` to dedupe packages.
|
|
||||||
# For a more pnpm-like experience, consider `hardlinks-global` where hardlinks point to a global store.
|
|
||||||
nmMode: hardlinks-local
|
nmMode: hardlinks-local
|
||||||
|
|
||||||
# How to install Node packages.
|
|
||||||
# Heads up: right now, Redwood expects this to be `node-modules`.
|
|
||||||
nodeLinker: node-modules
|
nodeLinker: node-modules
|
||||||
|
|
||||||
|
yarnPath: .yarn/releases/yarn-4.4.0.cjs
|
||||||
|
|||||||
@ -19,6 +19,7 @@ COPY --chown=node:node package.json .
|
|||||||
COPY --chown=node:node api/package.json api/
|
COPY --chown=node:node api/package.json api/
|
||||||
COPY --chown=node:node web/package.json web/
|
COPY --chown=node:node web/package.json web/
|
||||||
COPY --chown=node:node yarn.lock .
|
COPY --chown=node:node yarn.lock .
|
||||||
|
COPY --chown=node:node .yarn/releases/yarn-4.4.0.cjs .yarn/releases/
|
||||||
|
|
||||||
RUN mkdir -p /home/node/.yarn/berry/index
|
RUN mkdir -p /home/node/.yarn/berry/index
|
||||||
RUN mkdir -p /home/node/.cache
|
RUN mkdir -p /home/node/.cache
|
||||||
@ -82,6 +83,7 @@ COPY --chown=node:node .yarnrc.yml .
|
|||||||
COPY --chown=node:node package.json .
|
COPY --chown=node:node package.json .
|
||||||
COPY --chown=node:node api/package.json api/
|
COPY --chown=node:node api/package.json api/
|
||||||
COPY --chown=node:node yarn.lock .
|
COPY --chown=node:node yarn.lock .
|
||||||
|
COPY --chown=node:node .yarn/releases/yarn-4.4.0.cjs .yarn/releases/
|
||||||
|
|
||||||
RUN mkdir -p /home/node/.yarn/berry/index
|
RUN mkdir -p /home/node/.yarn/berry/index
|
||||||
RUN mkdir -p /home/node/.cache
|
RUN mkdir -p /home/node/.cache
|
||||||
@ -122,6 +124,7 @@ COPY --chown=node:node .yarnrc.yml .
|
|||||||
COPY --chown=node:node package.json .
|
COPY --chown=node:node package.json .
|
||||||
COPY --chown=node:node web/package.json web/
|
COPY --chown=node:node web/package.json web/
|
||||||
COPY --chown=node:node yarn.lock .
|
COPY --chown=node:node yarn.lock .
|
||||||
|
COPY --chown=node:node .yarn/releases/yarn-4.4.0.cjs .yarn/releases/
|
||||||
|
|
||||||
RUN mkdir -p /home/node/.yarn/berry/index
|
RUN mkdir -p /home/node/.yarn/berry/index
|
||||||
RUN mkdir -p /home/node/.cache
|
RUN mkdir -p /home/node/.cache
|
||||||
|
|||||||
@ -6,6 +6,10 @@
|
|||||||
"@redwoodjs/api": "8.3.0",
|
"@redwoodjs/api": "8.3.0",
|
||||||
"@redwoodjs/api-server": "8.3.0",
|
"@redwoodjs/api-server": "8.3.0",
|
||||||
"@redwoodjs/auth-dbauth-api": "8.3.0",
|
"@redwoodjs/auth-dbauth-api": "8.3.0",
|
||||||
"@redwoodjs/graphql-server": "8.3.0"
|
"@redwoodjs/graphql-server": "8.3.0",
|
||||||
|
"crypto-js": "^4.2.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/crypto-js": "^4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,9 +27,10 @@ export const handler = async (event: APIGatewayEvent, _context: Context) => {
|
|||||||
case '/oauth/microsoft/callback':
|
case '/oauth/microsoft/callback':
|
||||||
return await callback(event)
|
return await callback(event)
|
||||||
default:
|
default:
|
||||||
return {
|
return await callback(event)
|
||||||
|
/*return {
|
||||||
statusCode: 404,
|
statusCode: 404,
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
8
api/src/functions/oauthStart/oauthStart.scenarios.ts
Normal file
8
api/src/functions/oauthStart/oauthStart.scenarios.ts
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
import type { ScenarioData } from '@redwoodjs/testing/api'
|
||||||
|
|
||||||
|
export const standard = defineScenario({
|
||||||
|
// Define the "fixture" to write into your test database here
|
||||||
|
// See guide: https://redwoodjs.com/docs/testing#scenarios
|
||||||
|
})
|
||||||
|
|
||||||
|
export type StandardScenario = ScenarioData<unknown>
|
||||||
29
api/src/functions/oauthStart/oauthStart.test.ts
Normal file
29
api/src/functions/oauthStart/oauthStart.test.ts
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import { mockHttpEvent, mockContext } from '@redwoodjs/testing/api'
|
||||||
|
|
||||||
|
import { handler } from './oauthStart'
|
||||||
|
|
||||||
|
// Improve this test with help from the Redwood Testing Doc:
|
||||||
|
// https://redwoodjs.com/docs/testing#testing-functions
|
||||||
|
|
||||||
|
describe('oauthStart function', () => {
|
||||||
|
it('Should respond with 200', async () => {
|
||||||
|
const httpEvent = mockHttpEvent({
|
||||||
|
queryStringParameters: {
|
||||||
|
id: '42', // Add parameters here
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const response = await handler(httpEvent, mockContext())
|
||||||
|
const { data } = JSON.parse(response.body)
|
||||||
|
|
||||||
|
expect(response.statusCode).toBe(200)
|
||||||
|
expect(data).toBe('oauthStart function')
|
||||||
|
})
|
||||||
|
|
||||||
|
// You can also use scenarios to test your api functions
|
||||||
|
// See guide here: https://redwoodjs.com/docs/testing#scenarios
|
||||||
|
//
|
||||||
|
// scenario('Scenario test', async () => {
|
||||||
|
//
|
||||||
|
// })
|
||||||
|
})
|
||||||
42
api/src/functions/oauthStart/oauthStart.ts
Normal file
42
api/src/functions/oauthStart/oauthStart.ts
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
import type { APIGatewayEvent, Context } from 'aws-lambda'
|
||||||
|
|
||||||
|
import { logger } from 'src/lib/logger'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The handler function is your code that processes http request events.
|
||||||
|
* You can use return and throw to send a response or error, respectively.
|
||||||
|
*
|
||||||
|
* Important: When deployed, a custom serverless function is an open API endpoint and
|
||||||
|
* is your responsibility to secure appropriately.
|
||||||
|
*
|
||||||
|
* @see {@link https://redwoodjs.com/docs/serverless-functions#security-considerations|Serverless Function Considerations}
|
||||||
|
* in the RedwoodJS documentation for more information.
|
||||||
|
*
|
||||||
|
* @typedef { import('aws-lambda').APIGatewayEvent } APIGatewayEvent
|
||||||
|
* @typedef { import('aws-lambda').Context } Context
|
||||||
|
* @param { APIGatewayEvent } event - an object which contains information from the invoker.
|
||||||
|
* @param { Context } _context - contains information about the invocation,
|
||||||
|
* function, and execution environment.
|
||||||
|
*/
|
||||||
|
export const handler = async (event: APIGatewayEvent, _context: Context) => {
|
||||||
|
logger.info(`${event.httpMethod} ${event.path}: oauth function`)
|
||||||
|
|
||||||
|
switch (event.path) {
|
||||||
|
case '/oauthStart/microsoft':
|
||||||
|
return await callback()
|
||||||
|
default:
|
||||||
|
return await callback()
|
||||||
|
/* return {
|
||||||
|
statusCode: 404,
|
||||||
|
} */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const callback = async () => {
|
||||||
|
return {
|
||||||
|
statusCode: 302,
|
||||||
|
headers: {
|
||||||
|
Location: `https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=${process.env.MICROSOFT_OAUTH_CLIENT_ID}&grant_type=authorization_code&response_type=code&redirect_uri=${process.env.MICROSOFT_OAUTH_REDIRECT_URI}&scope=${process.env.MICROSOFT_OAUTH_SCOPES.split(' ').join('+')}`,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -8,11 +8,8 @@
|
|||||||
[web]
|
[web]
|
||||||
title = "Redwood App"
|
title = "Redwood App"
|
||||||
port = 8910
|
port = 8910
|
||||||
apiUrl = "/.redwood/functions" # You can customize graphql and dbauth urls individually too: see https://redwoodjs.com/docs/app-configuration-redwood-toml#api-paths
|
apiUrl = "/api" # You can customize graphql and dbauth urls individually too: see https://redwoodjs.com/docs/app-configuration-redwood-toml#api-paths
|
||||||
includeEnvironmentVariables = [
|
includeEnvironmentVariables = [
|
||||||
"MICROSOFT_OAUTH_CLIENT_ID",
|
|
||||||
"MICROSOFT_OAUTH_SCOPES",
|
|
||||||
"MICROSOFT_OAUTH_REDIRECT_URI",
|
|
||||||
# Add any ENV vars that should be available to the web side to this array
|
# Add any ENV vars that should be available to the web side to this array
|
||||||
# See https://redwoodjs.com/docs/environment-variables#web
|
# See https://redwoodjs.com/docs/environment-variables#web
|
||||||
]
|
]
|
||||||
|
|||||||
@ -53,11 +53,7 @@ export default function Hero() {
|
|||||||
</p>
|
</p>
|
||||||
<div className="mt-10 flex items-center gap-x-6">
|
<div className="mt-10 flex items-center gap-x-6">
|
||||||
<a
|
<a
|
||||||
href={`https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=${
|
href={`${window.RWJS_API_URL}/oauthStart/microsoft`}
|
||||||
process.env.MICROSOFT_OAUTH_CLIENT_ID
|
|
||||||
}&grant_type=authorization_code&response_type=code&redirect_uri=${
|
|
||||||
process.env.MICROSOFT_OAUTH_REDIRECT_URI
|
|
||||||
}&scope=${process.env.MICROSOFT_OAUTH_SCOPES.split(' ').join('+')}`}
|
|
||||||
className="rounded-md bg-indigo-600 px-3.5 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
|
className="rounded-md bg-indigo-600 px-3.5 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600"
|
||||||
>
|
>
|
||||||
Anmelden
|
Anmelden
|
||||||
|
|||||||
13
yarn.lock
13
yarn.lock
@ -7476,6 +7476,13 @@ __metadata:
|
|||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
"@types/crypto-js@npm:^4":
|
||||||
|
version: 4.2.2
|
||||||
|
resolution: "@types/crypto-js@npm:4.2.2"
|
||||||
|
checksum: 10c0/760a2078f36f2a3a1089ef367b0d13229876adcf4bcd6e8824d00d9e9bfad8118dc7e6a3cc66322b083535e12be3a29044ccdc9603bfb12519ff61551a3322c6
|
||||||
|
languageName: node
|
||||||
|
linkType: hard
|
||||||
|
|
||||||
"@types/debug@npm:^4.1.7":
|
"@types/debug@npm:^4.1.7":
|
||||||
version: 4.1.12
|
version: 4.1.12
|
||||||
resolution: "@types/debug@npm:4.1.12"
|
resolution: "@types/debug@npm:4.1.12"
|
||||||
@ -8624,6 +8631,8 @@ __metadata:
|
|||||||
"@redwoodjs/api-server": "npm:8.3.0"
|
"@redwoodjs/api-server": "npm:8.3.0"
|
||||||
"@redwoodjs/auth-dbauth-api": "npm:8.3.0"
|
"@redwoodjs/auth-dbauth-api": "npm:8.3.0"
|
||||||
"@redwoodjs/graphql-server": "npm:8.3.0"
|
"@redwoodjs/graphql-server": "npm:8.3.0"
|
||||||
|
"@types/crypto-js": "npm:^4"
|
||||||
|
crypto-js: "npm:^4.2.0"
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
@ -20856,11 +20865,11 @@ __metadata:
|
|||||||
|
|
||||||
"typescript@patch:typescript@npm%3A5.6.2#optional!builtin<compat/typescript>":
|
"typescript@patch:typescript@npm%3A5.6.2#optional!builtin<compat/typescript>":
|
||||||
version: 5.6.2
|
version: 5.6.2
|
||||||
resolution: "typescript@patch:typescript@npm%3A5.6.2#optional!builtin<compat/typescript>::version=5.6.2&hash=8c6c40"
|
resolution: "typescript@patch:typescript@npm%3A5.6.2#optional!builtin<compat/typescript>::version=5.6.2&hash=74658d"
|
||||||
bin:
|
bin:
|
||||||
tsc: bin/tsc
|
tsc: bin/tsc
|
||||||
tsserver: bin/tsserver
|
tsserver: bin/tsserver
|
||||||
checksum: 10c0/94eb47e130d3edd964b76da85975601dcb3604b0c848a36f63ac448d0104e93819d94c8bdf6b07c00120f2ce9c05256b8b6092d23cf5cf1c6fa911159e4d572f
|
checksum: 10c0/e6c1662e4852e22fe4bbdca471dca3e3edc74f6f1df043135c44a18a7902037023ccb0abdfb754595ca9028df8920f2f8492c00fc3cbb4309079aae8b7de71cd
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user