Skip to content

Updated to latest ACA-Py version for compatibility and improvements #159

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions AliceFaberAcmeDemo/controllers/acme-controller/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,18 @@
FROM node:22 as build
COPY . .
FROM node:22

WORKDIR /app

# Copy package.json and package-lock.json
COPY package*.json ./

# Install dependencies
RUN npm install
ENTRYPOINT [ "npm", "start" ]

# Copy the rest of the application files
COPY . .

# Expose the port the app runs on
EXPOSE 80

# Start the application
CMD ["node", "app.js"]
79 changes: 44 additions & 35 deletions AliceFaberAcmeDemo/controllers/acme-controller/app.js
Original file line number Diff line number Diff line change
@@ -1,57 +1,66 @@
var createError = require('http-errors');
const express = require('express');
const path = require('path');
const cookieParser = require('cookie-parser');
const logger = require('morgan');
const { engine } = require('express-handlebars');
const helpers = require('handlebars-helpers');

const indexRouter = require('./routes/index');
const connectionRouter = require('./routes/connection');
const proofRouter = require('./routes/proof');
var createError = require("http-errors");
const express = require("express");
const path = require("path");
const cookieParser = require("cookie-parser");
const logger = require("morgan");
const { engine } = require("express-handlebars");
const helpers = require("handlebars-helpers");

const indexRouter = require("./routes/index");
const connectionRouter = require("./routes/connection");
const proofRouter = require("./routes/proof");

const app = express();

// view engine setup
app.set('views', path.join(__dirname, 'views'));
app.set('view engine', 'hbs');
app.engine('hbs', engine({
extname: 'hbs',
defaultView: 'default',
layoutsDir: path.join(__dirname, '/views/layouts/'),
partialsDir: [
path.join(__dirname, '/views/partials'),
path.join(__dirname, '/views/partials/connection'),
path.join(__dirname, '/views/partials/home'),
path.join(__dirname, '/views/partials/proof'),
],
helpers: helpers(['array', 'comparison'])
}));

app.use(logger('dev'));
app.set("views", path.join(__dirname, "views"));
app.set("view engine", "hbs");
app.engine(
"hbs",
engine({
extname: "hbs",
defaultView: "default",
layoutsDir: path.join(__dirname, "/views/layouts/"),
partialsDir: [
path.join(__dirname, "/views/partials"),
path.join(__dirname, "/views/partials/connection"),
path.join(__dirname, "/views/partials/home"),
path.join(__dirname, "/views/partials/proof"),
],
helpers: helpers(["array", "comparison"]),
})
);

app.use(logger("dev"));
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(express.static(path.join(__dirname, 'public')));
app.use(express.static(path.join(__dirname, "public")));

app.use('/', indexRouter);
app.use('/connections', connectionRouter);
app.use('/proofs', proofRouter);
app.use("/", indexRouter);
app.use("/connections", connectionRouter);
app.use("/proofs", proofRouter);

// catch 404 and forward to error handler
app.use(function(req, res, next) {
app.use(function (req, res, next) {
next(createError(404));
});

// error handler
app.use(function(err, req, res, next) {
app.use(function (err, req, res, next) {
// set locals, only providing error in development
res.locals.message = err.message;
res.locals.error = req.app.get('env') === 'development' ? err : {};
res.locals.error = req.app.get("env") === "development" ? err : {};

// render the error page
res.status(err.status || 500);
res.render('error');
res.render("error");
});

// Start the server
const PORT = process.env.PORT || 80;
app.listen(PORT, () => {
console.log(`Server is running on port ${PORT}`);
});

module.exports = app;
13 changes: 13 additions & 0 deletions AliceFaberAcmeDemo/controllers/acme-controller/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: "3"
services:
acme-controller:
build: .
ports:
- "8140:80" # Expose a different port for the controller
environment:
- AGENT_HOST=host.docker.internal
- AGENT_PORT=8040
networks:
- aca
networks:
aca:
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"ext": "js,json,hbs,css"
},
"dependencies": {
"axios": "^1.8.3",
"cookie-parser": "^1.4.7",
"debug": "^2.6.9",
"express": "^4.21.1",
Expand Down
Loading