|
|
@ -23,24 +23,34 @@ export class Server { |
|
|
const env = await this.getEnv([ |
|
|
const env = await this.getEnv([ |
|
|
'PORT', |
|
|
'PORT', |
|
|
'BASE_URL', |
|
|
'BASE_URL', |
|
|
|
|
|
'REMOTE_BASE_URL', |
|
|
'GITEA_APP_BASE_URL', |
|
|
'GITEA_APP_BASE_URL', |
|
|
'GITEA_API_BASE_URL', |
|
|
'GITEA_API_BASE_URL', |
|
|
|
|
|
'GITEA_CLIENT_ID', |
|
|
|
|
|
'GITEA_CLIENT_SECRET', |
|
|
]) |
|
|
]) |
|
|
this.port = env.PORT ?? 3000 |
|
|
this.port = env.PORT ?? 3000 |
|
|
this.baseUrl = env.BASE_URL ?? '/macchiato' |
|
|
this.baseUrl = env.BASE_URL ?? '/macchiato' |
|
|
|
|
|
this.remoteBaseUrl = env.REMOTE_BASE_URL |
|
|
this.giteaAppBaseUrl = ( |
|
|
this.giteaAppBaseUrl = ( |
|
|
env.GITEA_APP_BASE_URL ?? 'http://gitea:3000' |
|
|
env.GITEA_APP_BASE_URL ?? 'http://gitea:3000' |
|
|
) |
|
|
) |
|
|
this.giteaApiBaseUrl = ( |
|
|
this.giteaApiBaseUrl = ( |
|
|
env.GITEA_API_BASE_URL ?? 'http://gitea:3000/api/v1' |
|
|
env.GITEA_API_BASE_URL ?? 'http://gitea:3000/api/v1' |
|
|
) |
|
|
) |
|
|
|
|
|
this.giteaClientId = env.GITEA_CLIENT_ID |
|
|
|
|
|
this.giteaClientSecret = env.GITEA_CLIENT_SECRET |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async init() { |
|
|
async init() { |
|
|
if (this.port === undefined) { |
|
|
if (this.port === undefined) { |
|
|
await this.configure() |
|
|
await this.configure() |
|
|
} |
|
|
} |
|
|
this.auth = new Auth() |
|
|
this.auth = new Auth({ |
|
|
|
|
|
remoteBaseUrl: this.remoteBaseUrl, |
|
|
|
|
|
clientId: this.giteaClientId, |
|
|
|
|
|
clientSecret: this.giteaClientSecret, |
|
|
|
|
|
}) |
|
|
this.frontend = new Frontend({ |
|
|
this.frontend = new Frontend({ |
|
|
appBaseUrl: this.giteaAppBaseUrl, |
|
|
appBaseUrl: this.giteaAppBaseUrl, |
|
|
apiBaseUrl: this.giteaApiBaseUrl, |
|
|
apiBaseUrl: this.giteaApiBaseUrl, |
|
|
|