api: fixes from refactor
This commit is contained in:
parent
3ae32aad3f
commit
4621f34e47
|
@ -1,13 +1,12 @@
|
||||||
FROM node:15.8.0-buster-slim
|
FROM node:15.8.0-buster-slim
|
||||||
RUN dpkg-reconfigure -p critical dash
|
RUN dpkg-reconfigure -p critical dash
|
||||||
RUN apt-get update && \
|
|
||||||
apt-get install -y libxml2 gnupg tar coreutils util-linux && \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
RUN for i in $(seq 1001 1500); do \
|
RUN for i in $(seq 1001 1500); do \
|
||||||
groupadd -g $i runner$i && \
|
groupadd -g $i runner$i && \
|
||||||
useradd -M runner$i -g $i -u $i ; \
|
useradd -M runner$i -g $i -u $i ; \
|
||||||
done
|
done
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y libxml2 gnupg tar coreutils util-linux libc6-dev binutils && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
WORKDIR /piston_api
|
WORKDIR /piston_api
|
||||||
|
|
|
@ -103,7 +103,7 @@ class Package {
|
||||||
);
|
);
|
||||||
|
|
||||||
proc.once('exit', (code, _) => {
|
proc.once('exit', (code, _) => {
|
||||||
code === 0 ? resolve() : reject();
|
code === 0 ? resolve(stdout) : reject();
|
||||||
});
|
});
|
||||||
|
|
||||||
proc.stdout.on('data', data => {
|
proc.stdout.on('data', data => {
|
||||||
|
|
|
@ -42,7 +42,7 @@ module.exports = {
|
||||||
async package_list(req, res) {
|
async package_list(req, res) {
|
||||||
logger.debug('Request to list packages');
|
logger.debug('Request to list packages');
|
||||||
|
|
||||||
const packages = await get_package_list();
|
let packages = await get_package_list();
|
||||||
|
|
||||||
packages = packages
|
packages = packages
|
||||||
.map(pkg => {
|
.map(pkg => {
|
||||||
|
|
|
@ -35,30 +35,30 @@ class Runtime {
|
||||||
}
|
}
|
||||||
|
|
||||||
get compiled() {
|
get compiled() {
|
||||||
if (this.compiled === undefined) {
|
if (this._compiled === undefined) {
|
||||||
this.compiled = fss.exists_sync(path.join(this.pkgdir, 'compile'));
|
this._compiled = fss.exists_sync(path.join(this.pkgdir, 'compile'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.compiled;
|
return this._compiled;
|
||||||
}
|
}
|
||||||
|
|
||||||
get env_vars() {
|
get env_vars() {
|
||||||
if (!this.env_vars) {
|
if (!this._env_vars) {
|
||||||
const env_file = path.join(this.pkgdir, '.env');
|
const env_file = path.join(this.pkgdir, '.env');
|
||||||
const env_content = fss.read_file_sync(env_file).toString();
|
const env_content = fss.read_file_sync(env_file).toString();
|
||||||
|
|
||||||
this.env_vars = {};
|
this._env_vars = {};
|
||||||
|
|
||||||
env_content
|
env_content
|
||||||
.trim()
|
.trim()
|
||||||
.split('\n')
|
.split('\n')
|
||||||
.map(line => line.split('=',2))
|
.map(line => line.split('=',2))
|
||||||
.forEach(([key,val]) => {
|
.forEach(([key,val]) => {
|
||||||
this.env_vars[key.trim()] = val.trim();
|
this._env_vars[key.trim()] = val.trim();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.env_vars;
|
return this._env_vars;
|
||||||
}
|
}
|
||||||
|
|
||||||
toString() {
|
toString() {
|
||||||
|
|
Loading…
Reference in New Issue