Skip to content

Commit 537c2ce

Browse files
committed
chore: added devcontainer settings
1 parent 699ac9d commit 537c2ce

7 files changed

Lines changed: 160 additions & 66 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#-------------------------------------------------------------------------------------------------------------
2+
# Copyright (c) Microsoft Corporation. All rights reserved.
3+
# Licensed under the MIT License. See https://go.microsoft.com/fwlink/?linkid=2090316 for license information.
4+
#-------------------------------------------------------------------------------------------------------------
5+
FROM node:22
6+
7+
# The node image includes a non-root user with sudo access. Use the
8+
# "remoteUser" property in devcontainer.json to use it. On Linux, update
9+
# these values to ensure the container user's UID/GID matches your local values.
10+
# See https://aka.ms/vscode-remote/containers/non-root-user for details.
11+
ARG USERNAME=node
12+
ARG USER_UID=1000
13+
ARG USER_GID=$USER_UID
14+
15+
RUN echo "deb http://archive.debian.org/debian stretch main" > /etc/apt/sources.list
16+
17+
# Configure apt and install packages
18+
RUN apt-get update \
19+
&& apt-get -y install --no-install-recommends dialog 2>&1 \
20+
# Verify git and needed tools are installed
21+
&& apt-get -y install git iproute2 procps \
22+
# Update npm to the latest version
23+
&& npm install -g npm@latest \
24+
# Clean up
25+
&& apt-get autoremove -y \
26+
&& apt-get clean -y \
27+
&& rm -rf /var/lib/apt/lists/*
28+
29+
# set up a nicer prompt
30+
RUN git clone https://github.com/magicmonty/bash-git-prompt.git ~/.bash-git-prompt --depth=1
31+
32+
RUN echo "source $HOME/.bash-git-prompt/gitprompt.sh" >> ~/.bashrc

.devcontainer/devcontainer.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "Switcher Resolver Node Dev Container",
3+
"dockerComposeFile": [
4+
"docker-compose.yml"
5+
],
6+
"service": "switcher-resolver-node",
7+
"workspaceFolder": "/workspace",
8+
"customizations":{
9+
"vscode": {
10+
"extensions": ["dbaeumer.vscode-eslint"],
11+
"settings": {
12+
"terminal.integrated.shell.linux": "/bin/bash"
13+
}
14+
}
15+
}
16+
}

.devcontainer/docker-compose.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
version: '3.9'
2+
3+
services:
4+
5+
switcher-resolver-node:
6+
build:
7+
context: .
8+
dockerfile: Dockerfile
9+
volumes:
10+
- ..:/workspace:cached
11+
command: sleep infinity
12+
13+
mongodb:
14+
image: mongo:latest
15+
restart: unless-stopped
16+
ports:
17+
- 27017:27017
18+
environment:
19+
MONGO_INITDB_DATABASE: switcher-api

.env-cmdrc-template

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,40 @@
11
{
2+
"dev": {
3+
"ENV": "TEST",
4+
"PORT": "3000",
5+
"SSL_CERT": "",
6+
"SSL_KEY": "",
7+
"MONGODB_URI": "mongodb://mongodb:27017/switcher-api",
8+
"RESOURCE_SECRET": "[MOCK_RESOURCE_SECRET]",
9+
"JWT_SECRET": "[MOCK_JWT_SECRET]",
10+
"JWT_CLIENT_TOKEN_EXP_TIME": "5m",
11+
"JWT_ADMIN_TOKEN_RENEW_INTERVAL": "5m",
12+
"RELAY_BYPASS_HTTPS": true,
13+
"RELAY_BYPASS_VERIFICATION": true,
14+
"METRICS_ACTIVATED": true,
15+
"REGEX_MAX_TIMEOUT": 3000,
16+
"REGEX_MAX_BLACKLIST": 50,
17+
"MAX_REQUEST_PER_MINUTE": 0,
18+
19+
"SWITCHER_API_LOGGER": true,
20+
"SWITCHER_API_LOGGER_LEVEL": "debug",
21+
22+
"SWITCHER_API_ENABLE": false,
23+
"SWITCHER_API_THROTTLE": 5000,
24+
"SWITCHER_API_URL": "http://localhost:3000",
25+
"SWITCHER_API_KEY": "MOCK_SWITCHER_API_KEY",
26+
"SWITCHER_API_DOMAIN": "MOCK_SWITCHER_API_DOMAIN",
27+
"SWITCHER_API_ENVIRONMENT": "default"
28+
},
229
"test": {
330
"NODE_OPTIONS": "--experimental-vm-modules",
431
"ENV": "TEST",
532
"PORT": "3000",
633
"SSL_CERT": "",
734
"SSL_KEY": "",
8-
"MONGODB_URI": "MOCK_MONGODB_URI",
35+
"MONGODB_URI": "mongodb://mongodb:27017/switcher-api-test",
936
"RESOURCE_SECRET": "[MOCK_RESOURCE_SECRET]",
10-
"JWT_SECRET": "MOCK_JWT_SECRET",
37+
"JWT_SECRET": "[MOCK_JWT_SECRET]",
1138
"JWT_CLIENT_TOKEN_EXP_TIME": "5m",
1239
"JWT_ADMIN_TOKEN_RENEW_INTERVAL": "5m",
1340
"RELAY_BYPASS_HTTPS": true,

.github/workflows/master.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
SWITCHER_API_LOGGER: false
5151

5252
- name: SonarCloud Scan
53-
uses: sonarsource/sonarqube-scan-action@v5.0.0
53+
uses: sonarsource/sonarqube-scan-action@v5.1.0
5454
env:
5555
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5656
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

npm-shrinkwrap.json

Lines changed: 62 additions & 62 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
},
6060
"devDependencies": {
6161
"env-cmd": "^10.1.0",
62-
"eslint": "^9.24.0",
62+
"eslint": "^9.25.0",
6363
"jest": "^29.7.0",
6464
"jest-sonar-reporter": "^2.0.0",
6565
"node-notifier": "^10.0.1",

0 commit comments

Comments
 (0)