Skip to content

Latest commit

 

History

History
51 lines (47 loc) · 4.44 KB

File metadata and controls

51 lines (47 loc) · 4.44 KB

# Debugging

Here you can find help with debugging the project.

Back to the main page.

Debugging

To test the web-site, you may want to start it using VSCode. Just do the following:

  • clone this repository
  • open it in VSCode
  • open a terminal window
  • npm install
  • make sure your .env in the repository root carries a SESSION_SECRET. The server signs its session cookies with it and refuses to start without one, so npm run start exits immediately with a message naming the variable. The .env this repository ships holds a placeholder — replace it with any long random string of your own; locally it is only ever compared against itself. Changing it later logs your own browser out once.
  • npm run start (the contents of the start-script are located in the package.json file)
  • Just press F5 to start debugging, while the webserver is running in the background You can use the built-in debugger now.

To check a change in a real browser instead of by hand, run npm test. It starts the server, completes the Keycloak login and verifies that it arrives on an authenticated page — see testing.

The following files are changed or omitted in the build-process:

FILE DESCRIPTION
.env -> pipeline
Will be re-generated from scratch during the pipeline-run using Github secrets.
Code is located in this repository in the yml file of the action.
keycloak.json -> pipeline
Will be generated from scratch during the pipeline-run using Github secrets.
So you're free to place a debugging-file of your own in here. The one that is present connects you to a test-server and will most likely not work with your fork.
package.json
package-lock.json
-> 'Dockerfile'
These files will be copied during the pipeline-run's Docker-Image generation and used to setup the web-server in the Docker container by running npm install afterwards.
app.js
.js
.css
-> 'Dockerfile'
app.js is the start-file for the NodeJS server. It is copied together with every other .js and .css file at the repository root during the pipeline-run's Docker-Image generation.
md/
assets/
middlewares/
css/
-> 'Dockerfile'
Copied whole into the image, so the corpus, the fonts and images, the middlewares and the stylesheets are part of the deployment.
index.html -> 'Dockerfile'
Copied as the start page a deployment falls back to when it sets no START_PAGE.
all other files... Will be ignored by the build-pipeline.

HttpYac (REST-Tests)

In order to get those working, you'll have to create a file httpyac.config.cjs with the following contents:

// Configuration file for HttpYac.
// A plugin for VSCode.
module.exports = {
  log: {
    supportAnsiColors: true
  },
  cookieJarEnabled: true,
  envDirName: 'env',
  environments: {
    $default: {
      url: 'http://localhost:8080',
      oidc: 'https://keycloak-server/auth/realms/test/protocol/openid-connect/token',
      userName: 'username',
      password: 'password'
    }
  }
}

Then you can run the REST-examples in the http directory.