Skip to content

Commit

Permalink
Merge pull request #88 from esciencecenter-digital-skills/issue73_bet…
Browse files Browse the repository at this point in the history
…ter_error_content_path

Add a better error message when CONTENT_PATH is not set
  • Loading branch information
raar1 authored Jan 15, 2025
2 parents 0732e49 + c6489e5 commit 6f63ed1
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@ import dotenv from 'dotenv';
import fs from 'fs'

dotenv.config();
console.log(`content path =`, process.env.CONTENT_PATH)
console.log(`Checking for content specified by CONTENT_PATH: `, process.env.CONTENT_PATH)

if(!process.env.CONTENT_PATH) {
throw new Error(`
Required environment variable CONTENT_PATH is not set.\n
In bash, use e.g. export CONTENT_PATH=/path/to/content/dir to set this\n\n
The content directory should have the same structure as shown in:\n
https://github.com/esciencecenter-digital-skills/NEBULA-content-template
`)
}

var publicProps = JSON.parse(fs.readFileSync(`${process.env.CONTENT_PATH}/config.json`, 'utf-8')).publicProps
console.log(`config file title =`, publicProps.title)
Expand Down Expand Up @@ -87,4 +96,4 @@ export default defineNuxtConfig({
},

compatibilityDate: '2024-09-04'
})
})

0 comments on commit 6f63ed1

Please sign in to comment.