summaryrefslogtreecommitdiff
path: root/typescript
diff options
context:
space:
mode:
authorms <ms@taler.net>2022-05-27 15:02:41 +0200
committerms <ms@taler.net>2022-05-27 15:02:41 +0200
commitf09ed4aedbc7ab30588ab3f91ef4db5b13960bca (patch)
treee71fbb178bb90c8935c93bdc28c51a8f87545ed8 /typescript
parentebd8d5b1fd55c7bfa359f80b58e56cdda3644723 (diff)
downloaddeployment-f09ed4aedbc7ab30588ab3f91ef4db5b13960bca.tar.gz
deployment-f09ed4aedbc7ab30588ab3f91ef4db5b13960bca.tar.bz2
deployment-f09ed4aedbc7ab30588ab3f91ef4db5b13960bca.zip
TypeScript Sandbox.
Compile and run source passed at runtime.
Diffstat (limited to 'typescript')
-rw-r--r--typescript/README9
-rw-r--r--typescript/container/Dockerfile7
-rw-r--r--typescript/container/prepare.sh2
-rwxr-xr-xtypescript/container/taler-config.js10
-rwxr-xr-xtypescript/container/taler-config.sh6
5 files changed, 15 insertions, 19 deletions
diff --git a/typescript/README b/typescript/README
index f0a9445..996ec7a 100644
--- a/typescript/README
+++ b/typescript/README
@@ -3,10 +3,7 @@ Building and running the image.
'cd' into 'container/' and run:
$ podman build -t $tag .
-After the build, run:
-$ podman run [-it] [-v /host/path/to/config-file:/config.ts] $tag
+Run it, passing a configuration expression:
+$ podman run -it [-v /host/path/to/config-file:/config.ts] $tag
-The "[-it]" part makes it interactive, although it won't
-be possible to kill the container only with CTRL-C. If "-v"
-is given, the contained application will read 'config-file'
-and configure/launch Taler according to it.
+Please, kill running container with 'podman kill'.
diff --git a/typescript/container/Dockerfile b/typescript/container/Dockerfile
index acea926..898aad1 100644
--- a/typescript/container/Dockerfile
+++ b/typescript/container/Dockerfile
@@ -37,7 +37,10 @@ RUN systemctl enable prepare
# taler-config interprets - at runtime - the
# TypeScript code that describes the deployment.
-COPY taler-config.js .
-RUN chmod +x taler-config.js
+COPY taler-config.sh .
+RUN chmod +x taler-config.sh
+
+# NOTE: should TS be installed from APT?
+RUN npm install -g typescript
CMD ["/sbin/init"]
diff --git a/typescript/container/prepare.sh b/typescript/container/prepare.sh
index e6b356a..7be811e 100644
--- a/typescript/container/prepare.sh
+++ b/typescript/container/prepare.sh
@@ -4,4 +4,4 @@ set -e
su -c "createuser --superuser root && createdb taler" postgres
-/taler-config.js
+/taler-config.sh
diff --git a/typescript/container/taler-config.js b/typescript/container/taler-config.js
deleted file mode 100755
index 4d01bf8..0000000
--- a/typescript/container/taler-config.js
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/bin/nodejs
-
-var fs = require("fs")
-
-try {
- const data = fs.readFileSync("/config.ts", "utf-8");
- console.log(data);
-} catch (error) {
- console.log(error);
-}
diff --git a/typescript/container/taler-config.sh b/typescript/container/taler-config.sh
new file mode 100755
index 0000000..3e17148
--- /dev/null
+++ b/typescript/container/taler-config.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+set -eu
+
+tsc /config.ts
+node /config.js