mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
feature(env) add env vars CLOUDCMD_TERMINAL, CLOUDCMD_TERMINAL_PATH
This commit is contained in:
parent
ecc7da732b
commit
85676cf023
7 changed files with 62 additions and 6 deletions
|
|
@ -5,9 +5,15 @@ RUN mkdir -p /usr/src/app
|
|||
WORKDIR /usr/src/app
|
||||
|
||||
COPY package.json /usr/src/app/
|
||||
RUN npm install --production
|
||||
|
||||
RUN npm install --production && \
|
||||
npm i gritty
|
||||
|
||||
COPY . /usr/src/app
|
||||
|
||||
ENV cloudcmd_terminal true
|
||||
ENV cloudcmd_terminal_path gritty
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
ENTRYPOINT ["bin/cloudcmd.js"]
|
||||
|
|
|
|||
|
|
@ -5,9 +5,26 @@ RUN mkdir -p /usr/src/app
|
|||
WORKDIR /usr/src/app
|
||||
|
||||
COPY package.json /usr/src/app/
|
||||
RUN npm install --production
|
||||
|
||||
RUN npm install --production && \
|
||||
apk add --no-cache git bash make g++ python && \
|
||||
npm i node-pty@">0.6.2" || \
|
||||
(cd node_modules && \
|
||||
git clone https://github.com/Tyriar/node-pty && \
|
||||
cd node-pty && \
|
||||
npm i && npm run tsc && \
|
||||
npm run install && \
|
||||
rm -rf .git && \
|
||||
cd ../..) && \
|
||||
npm i gritty && \
|
||||
apk del git make g++ python && \
|
||||
rm -rf /usr/include /tmp/* /var/cache/apk/*
|
||||
|
||||
COPY . /usr/src/app
|
||||
|
||||
ENV cloudcmd_terminal true
|
||||
ENV cloudcmd_terminal_path gritty
|
||||
|
||||
EXPOSE 8000
|
||||
|
||||
ENTRYPOINT ["bin/cloudcmd.js"]
|
||||
|
|
|
|||
7
HELP.md
7
HELP.md
|
|
@ -322,6 +322,13 @@ Here is description of options:
|
|||
}
|
||||
```
|
||||
|
||||
### Environment Variables
|
||||
|
||||
Some config options can be overriden with `environment variables` such:
|
||||
|
||||
- `CLOUDCMD_TERMINAL` - enable terminal
|
||||
- `CLOUDCMD_TERMINAL_PATH` - set terminal path
|
||||
|
||||
Menu
|
||||
---------------
|
||||

|
||||
|
|
|
|||
10
app.json
10
app.json
|
|
@ -16,6 +16,16 @@
|
|||
"description": "Keep false to install devDependencies and build frontend",
|
||||
"value": "false",
|
||||
"required": false
|
||||
},
|
||||
"CLOUDCMD_TERMINAL": {
|
||||
"description": "enable terminal",
|
||||
"value": "true",
|
||||
"required": false
|
||||
},
|
||||
"CLOUDCMD_TERMINAL_PATH": {
|
||||
"description": "set terminal path",
|
||||
"value": "gritty",
|
||||
"required": false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ const DIR_SERVER = '../server/';
|
|||
|
||||
const exit = require(DIR_SERVER + 'exit');
|
||||
const config = require(DIR_SERVER + 'config');
|
||||
const env = require(DIR_SERVER + 'env');
|
||||
|
||||
const argv = process.argv;
|
||||
const args = require('minimist')(argv.slice(2), {
|
||||
|
|
@ -51,9 +52,9 @@ const args = require('minimist')(argv.slice(2), {
|
|||
prefix : config('prefix') || '',
|
||||
progress : config('progress'),
|
||||
console : config('console'),
|
||||
terminal : config('terminal'),
|
||||
terminal : env.bool('terminal') || config('terminal'),
|
||||
|
||||
'terminal-path': config('terminalPath'),
|
||||
'terminal-path': env('terminal_path') || config('terminalPath'),
|
||||
'config-dialog': config('configDialog'),
|
||||
'one-panel-mode': config('onePanelMode'),
|
||||
'html-dialogs': config('htmlDialogs')
|
||||
|
|
@ -93,7 +94,7 @@ if (args.version) {
|
|||
config('progress', args.progress);
|
||||
config('console', args.console);
|
||||
config('terminal', args.terminal);
|
||||
config('terminalPath', args.terminalPath);
|
||||
config('terminalPath', args['terminal-path']);
|
||||
config('editor', args.editor);
|
||||
config('prefix', args.prefix);
|
||||
config('root', args.root);
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@
|
|||
"legacy:help": "cp json/help.json legacy/json/",
|
||||
"rm:server": "rimraf server_ legacy",
|
||||
"rm:client": "rimraf dist dist-dev",
|
||||
"heroku-postbuild": "redrun 6to5:client -- --progress"
|
||||
"heroku-postbuild": "redrun 6to5:client -- --progress && npm i gritty"
|
||||
},
|
||||
"directories": {
|
||||
"man": "man"
|
||||
|
|
|
|||
15
server/env.js
Normal file
15
server/env.js
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
'use strict';
|
||||
|
||||
const env = process.env;
|
||||
const up = (a) => a.toUpperCase();
|
||||
|
||||
module.exports = parse;
|
||||
module.exports.bool = (name) => Boolean(parse(name));
|
||||
|
||||
function parse(name) {
|
||||
const small = `cloudcmd_${name}`;
|
||||
const big = up(small);
|
||||
|
||||
return env[small] || env[big];
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue