pass gitea environment variables into auth

shared-server
bat 3 years ago
parent 0ba083fc9e
commit 499fff799f

@ -1,5 +1,22 @@
export class Auth {
constructor({
baseUrl,
remoteBaseUrl,
giteaAppBaseUrl,
giteaClientId,
giteaClientSecret
}) {
this.baseUrl = baseUrl
this.remoteBaseUrl = remoteBaseUrl
this.giteaAppBaseUrl = giteaAppBaseUrl
this.giteaClientId = giteaClientId
this.giteaClientSecret = giteaClientSecret
}
async redirect(event) {
const url = new URL(
this.remoteBaseUrl + '/'
)
event.respondWith(new Response(
'extract query and redirect', {status: 200}
))

@ -1,5 +1,5 @@
//import { Auth } from "./auth.js"
//import { Frontend } from "./frontend.js"
import { Auth } from "./auth.js"
import { Frontend } from "./frontend.js"
export class Server {
async getEnv(variables) {
@ -47,9 +47,11 @@ export class Server {
await this.configure()
}
this.auth = new Auth({
baseUrl: this.baseUrl,
remoteBaseUrl: this.remoteBaseUrl,
clientId: this.giteaClientId,
clientSecret: this.giteaClientSecret,
giteaAppBaseUrl: this.giteaAppBaseUrl,
giteaClientId: this.giteaClientId,
giteaClientSecret: this.giteaClientSecret,
})
this.frontend = new Frontend({
appBaseUrl: this.giteaAppBaseUrl,

Loading…
Cancel
Save