initial commit with apps from course repo

This commit is contained in:
Richard Allred
2019-05-23 13:13:16 -04:00
commit 497620c4d1
244 changed files with 6997 additions and 0 deletions

32
app-config/app.js Normal file
View File

@@ -0,0 +1,32 @@
var express = require('express');
var fs = require('fs')
app = express();
// read in the APP_MSG env var
var msg = process.env.APP_MSG;
var response;
app.get('/', function (req, res) {
response = 'Value in the APP_MSG env var is => ' + msg + '\n';
// Read in the secret file
fs.readFile('/opt/app-root/secure/myapp.sec', 'utf8', function (secerr,secdata) {
if (secerr) {
console.log(secerr + '\n');
response += secerr + '\n';
}
else {
response += 'The secret is => ' + secdata + '\n';
}
//send the response to the client
res.send(response);
});
});
app.listen(8080, function () {
console.log('Server listening on port 8080...');
});

3
app-config/myapp.sec Normal file
View File

@@ -0,0 +1,3 @@
username=user1
password=pass1
salt=xyz123

14
app-config/package.json Normal file
View File

@@ -0,0 +1,14 @@
{
"name": "node-configmap",
"version": "1.0.0",
"description": "A simple Node.js app to demonstrate config maps and secrets",
"main": "app.js",
"scripts": {
"start": "node app.js"
},
"author": "Red Hat Training",
"license": "ASL",
"dependencies": {
"express": "4.14.x"
}
}