mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-09 20:12:10 +10:00
* feat: set lang in html head * fix: add # in front of git ref * fix: remove unused vars from example env * fix: package name and license field * fix: enable sourcemap for client and server * fix: emojis not showing in prod this is extremely cursed, but it works * chore: refactor auth manager * feat: disable invitations if simple auth disabled * feat: add drop version to footer * feat: translate auth endpoints * chore: move oidc module * feat: add weekly tasks enabled object cleanup as weekly task * feat: add timestamp to task log msgs * feat: add guard to prevent invalid progress % * fix: add missing global scope to i18n components * feat: set base url for i18n * feat: switch task log to json format * ci: run ci on develop branch only * fix: UserWidget text not updating #109 * fix: EXTERNAL_URL being computed at build * feat: add basic language outlines for translation * feat: add more english dialects
67 lines
1.5 KiB
TypeScript
67 lines
1.5 KiB
TypeScript
class SystemConfig {
|
|
private libraryFolder = process.env.LIBRARY ?? "./.data/library";
|
|
private dataFolder = process.env.DATA ?? "./.data/data";
|
|
|
|
private externalUrl = process.env.EXTERNAL_URL ?? "http://localhost:3000";
|
|
private dropVersion;
|
|
private gitRef;
|
|
|
|
private checkForUpdates = getUpdateCheckConfig();
|
|
|
|
constructor() {
|
|
// get drop version and git ref from nuxt config
|
|
const config = useRuntimeConfig();
|
|
this.dropVersion = config.dropVersion;
|
|
this.gitRef = config.gitRef;
|
|
}
|
|
|
|
getLibraryFolder() {
|
|
return this.libraryFolder;
|
|
}
|
|
|
|
getDataFolder() {
|
|
return this.dataFolder;
|
|
}
|
|
|
|
getDropVersion() {
|
|
return this.dropVersion;
|
|
}
|
|
|
|
getGitRef() {
|
|
return this.gitRef;
|
|
}
|
|
|
|
shouldCheckForUpdates() {
|
|
return this.checkForUpdates;
|
|
}
|
|
|
|
getExternalUrl() {
|
|
return this.externalUrl;
|
|
}
|
|
}
|
|
|
|
export const systemConfig = new SystemConfig();
|
|
|
|
/**
|
|
* Gets the configuration for checking updates based on various conditions
|
|
* @returns true if updates should be checked, false otherwise.
|
|
*/
|
|
function getUpdateCheckConfig(): boolean {
|
|
const envCheckUpdates = process.env.CHECK_FOR_UPDATES;
|
|
|
|
// Check environment variable
|
|
if (envCheckUpdates !== undefined) {
|
|
// if explicitly set to true or false, return that value
|
|
if (envCheckUpdates.toLocaleLowerCase() === "true") {
|
|
return true;
|
|
} else if (envCheckUpdates.toLocaleLowerCase() === "false") {
|
|
return false;
|
|
}
|
|
} else if (process.env.NODE_ENV === "production") {
|
|
// default to true in production
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|