Separate environment configs (#6597)

* Separate environment configs

* wip

* wip

* test

* plugins

* test

* test

* .sequelizerc, unfortunately can't go through /utils/environment due to not supporting TS

* docker-compose -> docker compose

* fix: .local wipes .development

* Add custom validation message for invalid SECRET_KEY (often confused)
This commit is contained in:
Tom Moor
2024-02-27 09:24:23 -08:00
committed by GitHub
parent 415383a1c9
commit 60e52d0423
45 changed files with 489 additions and 409 deletions

View File

@@ -14,6 +14,7 @@ import { PartialWithId } from "~/types";
import { client } from "~/utils/ApiClient";
import Desktop from "~/utils/Desktop";
import Logger from "~/utils/Logger";
import history from "~/utils/history";
import isCloudHosted from "~/utils/isCloudHosted";
import Store from "./base/Store";
@@ -304,16 +305,15 @@ export default class AuthStore extends Store<Team> {
}
};
/**
* Logs the user out and optionally revokes the authentication token.
*
* @param savePath Whether the current path should be saved and returned to after login.
* @param tryRevokingToken Whether the auth token should attempt to be revoked, this should be
* disabled with requests from ApiClient to prevent infinite loops.
*/
@action
logout = async (
/** Whether the current path should be saved and returned to after login */
savePath = false,
/**
* Whether the auth token should attempt to be revoked, this should be disabled
* with requests from ApiClient to prevent infinite loops.
*/
tryRevokingToken = true
) => {
logout = async (savePath = false, tryRevokingToken = true) => {
// if this logout was forced from an authenticated route then
// save the current path so we can go back there once signed in
if (savePath) {
@@ -348,9 +348,16 @@ export default class AuthStore extends Store<Team> {
this.currentUserId = null;
this.currentTeamId = null;
this.collaborationToken = null;
this.rootStore.clear();
// Tell the host application we logged out, if any allows window cleanup.
void Desktop.bridge?.onLogout?.();
this.rootStore.clear();
if (Desktop.isElectron()) {
void Desktop.bridge?.onLogout?.();
} else if (env.OIDC_LOGOUT_URI) {
window.location.replace(env.OIDC_LOGOUT_URI);
return;
}
history.replace("/");
};
}