-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from sgtoj/dev
- Loading branch information
Showing
83 changed files
with
20,089 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,20 @@ jobs: | |
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
- name: Setup Node | ||
uses: actions/[email protected] | ||
with: | ||
node-version: 18 | ||
- name: Tests for auth-at-edge | ||
run: | | ||
cd assets/cf-mw-auth | ||
npm install | ||
npm test | ||
- name: Tests for url-rewriter | ||
run: | | ||
cd assets/cf-mw-urlrewrite | ||
npm install | ||
npm test | ||
- name: Bump Version | ||
id: tag_version | ||
uses: mathieudutour/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: test | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
- name: Setup Node | ||
uses: actions/[email protected] | ||
with: | ||
node-version: 18 | ||
- name: Tests for auth-at-edge | ||
run: | | ||
cd assets/cf-mw-auth | ||
npm install | ||
npm test | ||
- name: Tests for url-rewriter | ||
run: | | ||
cd assets/cf-mw-urlrewrite | ||
npm install | ||
npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
PROJ_ROOT := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) | ||
|
||
# allows args to pass to run-cmd example: make run-cmd echo "hello world" | ||
ifeq (run-cmd,$(firstword $(MAKECMDGOALS))) | ||
RUN_ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)) | ||
$(eval $(RUN_ARGS):;@:) | ||
endif | ||
|
||
all: deps build | ||
@exit 0 | ||
|
||
deps: | ||
@exit 0 | ||
|
||
build: | ||
@exit 0 | ||
|
||
clean: | ||
@find . -type d -name "dist" -exec rm -rf {} + | ||
@find . -type d -name ".terraform" -exec rm -rf {} + | ||
@find . -type d -name ".terraform.d" -exec rm -rf {} + | ||
@find . -type d -name ".tfstate" -exec rm -rf {} + | ||
@find . -type d -name ".tfstate.backup" -exec rm -rf {} + | ||
@touch .devcontainer/.terraform.d/.gitkeep || true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
.gitignore | ||
.git | ||
|
||
*Dockerfile* | ||
*docker-compose* | ||
.dockerignore | ||
|
||
.vscode/ | ||
node_modules/ | ||
|
||
*.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
module.exports = { | ||
plugins: [ | ||
'import', | ||
'jest', | ||
], | ||
rules: { | ||
'func-style': 'error', | ||
}, | ||
overrides: [ | ||
{ | ||
files: [ | ||
'**/*.{ts,tsx}', | ||
], | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
ecmaVersion: 2019, | ||
sourceType: 'module', | ||
tsconfigRootDir: __dirname, | ||
project: [ | ||
'./tsconfig.json', | ||
], | ||
}, | ||
plugins: [ | ||
'@typescript-eslint', | ||
], | ||
extends: [ | ||
'airbnb-typescript/base', | ||
], | ||
rules: { | ||
'@typescript-eslint/no-unused-vars': 'warn', | ||
'@typescript-eslint/no-floating-promises': 'error', | ||
}, | ||
}, | ||
{ | ||
files: [ | ||
'scripts/**/*.js', | ||
], | ||
parserOptions: { | ||
ecmaVersion: "latest", | ||
}, | ||
env: { | ||
es6: true | ||
} | ||
} | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# ------------------------------------------------------------------- base --- | ||
|
||
FROM node:18 as base | ||
|
||
RUN mkdir -p /opt/app | ||
WORKDIR /opt/app | ||
|
||
ENV NODE_ENV development | ||
|
||
# intentally not installing node_modules inside the /opt/app dir; this makes | ||
# for a better experience when using image in development environment | ||
ADD package*.json /opt/ | ||
RUN npm ci | ||
|
||
ADD ./ ./ | ||
|
||
# -------------------------------------------------------------------- test --- | ||
|
||
FROM base as test | ||
|
||
RUN npm run lint && npm run test | ||
|
||
# -------------------------------------------------------------------- test --- | ||
|
||
FROM test as build | ||
|
||
ENV OPA_VERSION=0.49.0 | ||
RUN SYSTEM_ARCH=$(dpkg --print-architecture) \ | ||
&& curl -L -o opa https://github.com/open-policy-agent/opa/releases/download/v${OPA_VERSION}/opa_linux_${SYSTEM_ARCH}_static \ | ||
&& mv opa /usr/bin/opa \ | ||
&& chmod +x /usr/bin/opa \ | ||
&& opa -h | ||
|
||
RUN npm run build | ||
|
||
ARG SERVICE_POLICY_ENCODED=cGFja2FnZSBhdXRoX2F0X2VkZ2VfYXV0aHoKcmVzdWx0cyA6PSBbXQo= | ||
RUN echo "$SERVICE_POLICY_ENCODED" | base64 -d > /opt/app/dist/policy.rego | ||
|
||
RUN opa build -t wasm -e auth_at_edge_authz/results /opt/app/dist/policy.rego \ | ||
&& tar -zxv -C /opt/app/dist -f bundle.tar.gz '/policy.wasm' | ||
|
||
# ----------------------------------------------------------------- package --- | ||
|
||
FROM alpine:latest as package | ||
|
||
RUN apk add jq | ||
|
||
ARG SERVICE_CONFIG_ENCODED=e30K | ||
|
||
COPY --from=build /opt/app/dist /opt/app/dist | ||
COPY --from=build /opt/package-lock.json /opt/app/dist/ | ||
|
||
RUN echo "$SERVICE_CONFIG_ENCODED" | base64 -d | jq > /opt/app/dist/configuration.json | ||
|
||
RUN apk add zip \ | ||
&& cd /opt/app/dist \ | ||
&& zip -r /tmp/package.zip . | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
verbose: true, | ||
resetMocks: true, | ||
testPathIgnorePatterns: [ | ||
"dist" | ||
], | ||
|
||
moduleNameMapper: { | ||
"#node-web-compat": "./node-web-compat-node.js", | ||
}, | ||
}; | ||
|
||
process.env = Object.assign(process.env, { | ||
LOG_LEVEL: 'silent', | ||
}); |
Oops, something went wrong.