Skip to content

Commit

Permalink
Merge pull request #51 from secure-dashboards/feat/add-script
Browse files Browse the repository at this point in the history
  • Loading branch information
UlisesGascon authored Dec 7, 2024
2 parents 17eeaa5 + 4ac91af commit e9d2078
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,5 @@ dist


# CUSTOM
IGNORE/
IGNORE/
output
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"db:migrate": "knex migrate:latest",
"db:rollback": "knex migrate:rollback",
"db:generate-schema": "docker-compose run schema-dump",
"db:export-checks": "node scripts/export-checks.js",
"db:seed": "knex seed:run"
},
"keywords": [],
Expand Down
12 changes: 12 additions & 0 deletions scripts/export-checks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const { writeFileSync } = require('fs')
const { getConfig } = require('../src/config')
const { dbSettings } = getConfig()
const knex = require('knex')(dbSettings)
const { join } = require('path')

;(async () => {
const checks = await knex('compliance_checks').select()
writeFileSync(join(process.cwd(), 'output', 'checks.json'), JSON.stringify(checks, null, 2))
console.log('Checks exported to checks.json')
await knex.destroy()
})()

0 comments on commit e9d2078

Please sign in to comment.