initial commit with apps from course repo
This commit is contained in:
32
app-config/app.js
Normal file
32
app-config/app.js
Normal 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
3
app-config/myapp.sec
Normal file
@@ -0,0 +1,3 @@
|
||||
username=user1
|
||||
password=pass1
|
||||
salt=xyz123
|
||||
14
app-config/package.json
Normal file
14
app-config/package.json
Normal 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"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user