Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ jobs:
- name: Checkout code
uses: actions/checkout@v5

- name: Create custom.config.mjs from secret
run: |
if [ -n "${{ secrets.CUSTOM_CONFIG }}" ]; then
cat > custom.config.mjs << 'EOF'
${{ secrets.CUSTOM_CONFIG }}
EOF
echo "custom.config.mjs created from secret"
else
echo "CUSTOM_CONFIG secret not set, skipping custom.config.mjs creation"
fi

- name: Setup Node.js
uses: actions/setup-node@v6
with:
Expand Down
22 changes: 18 additions & 4 deletions config-loader.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,25 @@ const defaultConfig = {
// Try to load custom config (optional, for forks)
let customConfig = {};
try {
const customModule = await import('./custom.config.mjs');
customConfig = customModule.default || customModule || {};
// Check if file exists before importing
const fs = await import('node:fs');
const path = await import('node:path');
const { fileURLToPath, pathToFileURL } = await import('node:url');

// Get the directory of the current module
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const customConfigPath = path.join(__dirname, 'custom.config.mjs');

if (fs.existsSync(customConfigPath)) {
// Use dynamic import with file:// URL to prevent static analysis by Vite/Rollup
const customConfigUrl = pathToFileURL(customConfigPath).href;
const customModule = await import(customConfigUrl);
customConfig = customModule.default || customModule || {};
}
} catch (error) {
// custom.config.mjs doesn't exist, use defaults only
// This is expected for the default repository
// custom.config.mjs doesn't exist or couldn't be loaded, use defaults only
// This is expected for the default repository or when file is missing
}

// Deep merge function for nested objects
Expand Down
Loading