Compare commits
No commits in common. "a335d5c14f0b61fa020619fcbe565562736c181e" and "a9cf2a1d210444bc37988b02b4a0dfbf0db9a4b9" have entirely different histories.
a335d5c14f
...
a9cf2a1d21
|
@ -30,4 +30,5 @@ cd to `react/resume` and run `build.sh`.
|
|||
If you are running in debug mode, run `yarn/npm start`
|
||||
|
||||
## Generate the key
|
||||
Cd to root of project and run `scripts/generate_key.py`
|
||||
Install node modules in following directories: `.`, `./scripts`
|
||||
Then, cd to root and run `node scripts/generate_key.js`
|
7
dev.sh
7
dev.sh
|
@ -1,12 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ ! -f .env ]; then
|
||||
echo "No .env; Please create .env and try again"
|
||||
exit
|
||||
fi
|
||||
|
||||
. '.env'
|
||||
|
||||
cp docker-compose.dev docker-compose.yml
|
||||
cp Dockerfile.dev Dockerfile
|
||||
|
||||
|
|
|
@ -26,8 +26,7 @@ config = {
|
|||
host: DB_HOSTNAME || config.host,
|
||||
define: {
|
||||
timestamps: false
|
||||
},
|
||||
logging: false
|
||||
}
|
||||
};
|
||||
|
||||
/** @type Sequelize */
|
||||
|
|
7
prod.sh
7
prod.sh
|
@ -1,12 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
if [ ! -f .env ]; then
|
||||
echo "No .env; Please create .env and try again"
|
||||
exit
|
||||
fi
|
||||
|
||||
. '.env'
|
||||
|
||||
cp docker-compose.prod docker-compose.yml
|
||||
cp Dockerfile.prod Dockerfile
|
||||
|
||||
|
|
|
@ -1,37 +0,0 @@
|
|||
import { Terminal } from 'xterm';
|
||||
import { saveAs } from 'file-saver';
|
||||
const fs = require('../fs');
|
||||
|
||||
/**
|
||||
*
|
||||
* @param { string[] } argv
|
||||
* @param { Terminal } terminal
|
||||
*/
|
||||
module.exports = (argv, terminal) => {
|
||||
|
||||
if (argv.indexOf('--help') != -1) {
|
||||
terminal.write(
|
||||
`Usage: ${argv[0]} [DESTANATION]\n
|
||||
Import files from your system to this filesystem.
|
||||
`
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
let el = document.getElementById('upload_file_btn');
|
||||
if (el == null) {
|
||||
el = document.createElement('input');
|
||||
el.style.display = 'none';
|
||||
el.type = 'file';
|
||||
el.id = 'upload_file_btn';
|
||||
el.setAttribute('multiple', 'multiple');
|
||||
document.body.appendChild(el);
|
||||
}
|
||||
|
||||
const dir = argv[1] || '.';
|
||||
|
||||
el.click();
|
||||
|
||||
let files = el.files;
|
||||
global.f = files
|
||||
}
|
|
@ -8,7 +8,6 @@ let cmds = {
|
|||
'mkdir': require('./mkdir'),
|
||||
'wget': require('./wget'),
|
||||
'export_file': require('./export_file'),
|
||||
'import_file': require('./import_file'),
|
||||
|
||||
// alias l='ls -l'
|
||||
'l': (a,t) => {require('./ls')([...a, '-l'], t)},
|
||||
|
|
|
@ -107,9 +107,8 @@ function reset_cmd() {
|
|||
}
|
||||
|
||||
function cbackspace() {
|
||||
let exploded = cmd.substring(0, cmd.length - 2).split(' ');
|
||||
|
||||
if (exploded.length == 1) {
|
||||
let exploded = cmd.split(' ');
|
||||
if (exploded.length >= 1) {
|
||||
reprint_prompt();
|
||||
cmd = '';
|
||||
return;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
const handler = require('express-async-handler');
|
||||
const Helpers = require('../helpers');
|
||||
|
||||
async function project(req, res) {
|
||||
res.template(
|
||||
|
|
|
@ -1,3 +1,53 @@
|
|||
const { exec } = require('child_process');
|
||||
const crypto = require('crypto');
|
||||
const path = require('path');
|
||||
const args = require('args-parser')(process.argv);
|
||||
const fs = require('fs');
|
||||
const base64 = require('js-base64');
|
||||
|
||||
exec('generate_key.py');
|
||||
let key = crypto.randomFillSync(Buffer.alloc(32)).toString('base64');
|
||||
let dotenv = path.resolve('.env');
|
||||
|
||||
if (args['help']) {
|
||||
console.log(path.basename(__filename) + ' [--key-only] [--env|-e] [--set-key] [--dry-run] [--stdout|-s]');
|
||||
console.log('\n' +
|
||||
' --help: Display this help\n' +
|
||||
' --key-only: Generate key only and put it in stdout\n' +
|
||||
' --env -e: Specify an env file\n' +
|
||||
' --set-key: Specify your key\n' +
|
||||
' --dry-run: Don\'t write anything, just do the thing\n' +
|
||||
' --stdout -s: Don\'t write to file, write to stdout instead'
|
||||
);
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
if (args['key-only']) {
|
||||
console.log(key);
|
||||
process.exit(0);
|
||||
}
|
||||
if (args['env'] || args['e']) {
|
||||
dotenv = args['env'] ? args['env'] : args['e'];
|
||||
}
|
||||
if (args['set-key']) {
|
||||
key = args['set-key'];
|
||||
}
|
||||
|
||||
const file = fs.readFileSync(dotenv).toString('utf8');
|
||||
|
||||
let lines = file.split('\n');
|
||||
|
||||
for (let i = 0; i != lines.length; i++) {
|
||||
let line = lines[i];
|
||||
if (line.startsWith('APP_KEY=')) {
|
||||
lines[i] = 'APP_KEY=' + key;
|
||||
}
|
||||
}
|
||||
|
||||
const newfile = lines.join('\n');
|
||||
|
||||
const w_stdout = args['stdout'] || args['s'];
|
||||
|
||||
if (!args['dry-run']) {
|
||||
if (w_stdout) console.log(newfile);
|
||||
else
|
||||
fs.writeFileSync(dotenv, newfile);
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import secrets
|
||||
import base64
|
||||
|
||||
if (not os.path.exists('.env')):
|
||||
print('No .env file found. Please create a dotenv to proceed.');
|
||||
exit(-1);
|
||||
|
||||
key_bytes = secrets.token_bytes(32);
|
||||
dotenv_text = '';
|
||||
|
||||
with open('.env', 'tr', encoding='utf-8') as f:
|
||||
dotenv_text = f.read();
|
||||
|
||||
dotenv_lines = dotenv_text.split('\n');
|
||||
key_line = 0;
|
||||
|
||||
for i, line in enumerate(dotenv_lines):
|
||||
if (line.startswith('APP_KEY=')):
|
||||
dotenv_lines[i] = 'APP_KEY=' + base64.b64encode(key_bytes).decode('utf-8');
|
||||
|
||||
with open('.env', 'tw', encoding='utf-8') as f: print('\n'.join(dotenv_lines), file=f)
|
Loading…
Reference in New Issue