Implement a more robust Config (#60)
* Implement a more robust Config This moves the configuration variables from the `.env` file to a new `bewcloud.config.ts` file. Note that DB connection and secrets are still in the `.env` file. This will allow for more reliable and easier personalized configurations, and was a requirement to start working on adding SSO (#13). For now, `.env`-based config will still be allowed and respected (overriden by `bewcloud.config.ts`), but in the future I'll probably remove it (some major upgrade). * Update deploy script to also copy the new config file
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import { Head } from 'fresh/runtime.ts';
|
||||
|
||||
import { User } from '/lib/types.ts';
|
||||
import { isAppEnabled } from '/lib/config.ts';
|
||||
import { OptionalApp, User } from '/lib/types.ts';
|
||||
|
||||
interface Data {
|
||||
route: string;
|
||||
user?: User;
|
||||
enabledApps: OptionalApp[];
|
||||
}
|
||||
|
||||
interface MenuItem {
|
||||
@@ -13,7 +13,7 @@ interface MenuItem {
|
||||
label: string;
|
||||
}
|
||||
|
||||
export default function Header({ route, user }: Data) {
|
||||
export default function Header({ route, user, enabledApps }: Data) {
|
||||
const activeClass = 'bg-slate-800 text-white rounded-md px-3 py-2 text-sm font-medium';
|
||||
const defaultClass = 'text-slate-300 hover:bg-slate-700 hover:text-white rounded-md px-3 py-2 text-sm font-medium';
|
||||
|
||||
@@ -28,7 +28,7 @@ export default function Header({ route, user }: Data) {
|
||||
url: '/dashboard',
|
||||
label: 'Dashboard',
|
||||
},
|
||||
isAppEnabled('news')
|
||||
enabledApps.includes('news')
|
||||
? {
|
||||
url: '/news',
|
||||
label: 'News',
|
||||
@@ -38,19 +38,19 @@ export default function Header({ route, user }: Data) {
|
||||
url: '/files',
|
||||
label: 'Files',
|
||||
},
|
||||
isAppEnabled('notes')
|
||||
enabledApps.includes('notes')
|
||||
? {
|
||||
url: '/notes',
|
||||
label: 'Notes',
|
||||
}
|
||||
: null,
|
||||
isAppEnabled('photos')
|
||||
enabledApps.includes('photos')
|
||||
? {
|
||||
url: '/photos',
|
||||
label: 'Photos',
|
||||
}
|
||||
: null,
|
||||
isAppEnabled('expenses')
|
||||
enabledApps.includes('expenses')
|
||||
? {
|
||||
url: '/expenses',
|
||||
label: 'Expenses',
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { useSignal } from '@preact/signals';
|
||||
|
||||
import { Directory, DirectoryFile } from '/lib/types.ts';
|
||||
import { baseUrl } from '/lib/utils/misc.ts';
|
||||
import { ResponseBody as UploadResponseBody } from '/routes/api/files/upload.tsx';
|
||||
import { RequestBody as RenameRequestBody, ResponseBody as RenameResponseBody } from '/routes/api/files/rename.tsx';
|
||||
import { RequestBody as MoveRequestBody, ResponseBody as MoveResponseBody } from '/routes/api/files/move.tsx';
|
||||
@@ -33,9 +32,10 @@ interface MainFilesProps {
|
||||
initialDirectories: Directory[];
|
||||
initialFiles: DirectoryFile[];
|
||||
initialPath: string;
|
||||
baseUrl: string;
|
||||
}
|
||||
|
||||
export default function MainFiles({ initialDirectories, initialFiles, initialPath }: MainFilesProps) {
|
||||
export default function MainFiles({ initialDirectories, initialFiles, initialPath, baseUrl }: MainFilesProps) {
|
||||
const isAdding = useSignal<boolean>(false);
|
||||
const isUploading = useSignal<boolean>(false);
|
||||
const isDeleting = useSignal<boolean>(false);
|
||||
|
||||
Reference in New Issue
Block a user