This commit is contained in:
2025-12-15 12:28:00 -06:00
parent bdc709ec2a
commit cf1ffac9ee
14 changed files with 3181 additions and 1 deletions
+63
View File
@@ -0,0 +1,63 @@
// Configuration loader
let appConfig = null;
/**
* Load configuration from config.json
*/
async function loadConfig() {
if (appConfig) {
return appConfig;
}
try {
const response = await fetch('/config.json');
if (!response.ok) {
throw new Error(`Failed to load config: ${response.statusText}`);
}
appConfig = await response.json();
return appConfig;
} catch (error) {
console.error('Error loading config:', error);
// Return default config if file can't be loaded
return {
pocketbase: {
collections: {
jobs: "Job_Info",
notes: "notes",
users: "users"
}
},
pagination: {
itemsPerPage: 20
},
filters: {
defaultFilter: "all"
}
};
}
}
/**
* Get the jobs collection name
*/
async function getJobsCollection() {
const config = await loadConfig();
return config.pocketbase.collections.jobs;
}
/**
* Get the notes collection name
*/
async function getNotesCollection() {
const config = await loadConfig();
return config.pocketbase.collections.notes;
}
/**
* Get items per page setting
*/
async function getItemsPerPage() {
const config = await loadConfig();
return config.pagination.itemsPerPage || 20;
}