Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
zekth committed Dec 12, 2023
0 parents commit c72273d
Show file tree
Hide file tree
Showing 23 changed files with 5,966 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

[*]
end_of_line = lf
insert_final_newline = true
indent_size = 2
indent_style = space

charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
max_line_length = 120
6 changes: 6 additions & 0 deletions .env.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
## The token for the third party Identity Provider
OKTA_API_TOKEN=atoken
## The base domain for the Identity Provider
OKTA_DOMAIN=https://dev-something.okta.com/
## Comma-separated tokens from Konnect
KONG_API_TOKENS=oldtoken,newtoken
65 changes: 65 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{
"env": {
"browser": false,
"es6": true,
"node": true,
"jest/globals": true
},
"extends": "standard-with-typescript",
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"jest"
],
"rules": {
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"no-unused-vars": [
"warn"
],
"no-console": "off",
"semi": "off",
"no-undef": "error",
"no-redeclare": "error",
"no-trailing-spaces": "error",
"eol-last": [
"error",
"always"
],
"no-multiple-empty-lines": [
"error",
{
"max": 1,
"maxEOF": 1
}
],
"@typescript-eslint/prefer-nullish-coalescing": "off",
"@typescript-eslint/consistent-type-imports": "off",
"@typescript-eslint/strict-boolean-expressions": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-floating-promises": "off",
"@typescript-eslint/unbound-method": "off",
"no-return-await": "error",
"@typescript-eslint/return-await": "off",
"prefer-const": "error",
"arrow-spacing": [
"error",
{
"before": true,
"after": true
}
]
}
}
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/.yarn/** linguist-vendored
/.yarn/releases/* binary
/.yarn/plugins/**/* binary
/.pnp.* binary linguist-generated
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @Kong/team-devx
73 changes: 73 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: CI
concurrency:
group: ${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
on:
pull_request: {}
push:
branches:
- main
env:
AWS_ROLE_NAME: ${{ secrets.AWS_ROLE_NAME }}
BUCKET_NAME: ${{ secrets.BUCKET_NAME }}
FUNCTION_NAME: ${{ secrets.FUNCTION_NAME }}

jobs:
test:
runs-on: ubuntu-latest
# environment and permissions are required when using the role-to-assume
# function of aws-actions/configure-aws-credentials
# More informations on: https://github.com/aws-actions/configure-aws-credentials
environment: dev
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: install dependencies
run: yarn
- name: lint
run: yarn lint
- name: test
run: yarn test
# building the target bundle and then copying the package.json
# to be able to install the node_modules in the dist files to be
# zipped afterward to land in s3 for the lambda function to update its code on
# note: we use production and frozen-lockfile to avoid undefined behaviors of
# dependencies updates and we only install runtime required dependencies
- name: build
run: |
yarn build
cp package.json dist/package.json
cd dist
yarn --production --frozen-lockfile
- name: zip
run: |
cd dist && zip -r ../build.zip *
- name: Configure AWS credentials
if: github.ref == 'refs/heads/main'
uses: aws-actions/[email protected]
with:
role-to-assume: ${{ env.AWS_ROLE_NAME }}
aws-region: us-east-2
role-session-name: HttpDcrLambdaCiUsEast2
role-duration-seconds: 1200
mask-aws-account-id: 'true'
- name: Send to S3
if: github.ref == 'refs/heads/main'
run: |
aws s3 cp ./build.zip s3://${{ env.BUCKET_NAME }}/lambda-dcr-http.zip \
--storage-class REDUCED_REDUNDANCY \
--acl private \
--no-progress
- name: Deploy Lambda function
if: github.ref == 'refs/heads/main'
run: |
aws lambda update-function-code \
--function-name ${{ env.FUNCTION_NAME }} \
--s3-bucket ${{ env.BUCKET_NAME }} \
--s3-key lambda-dcr-http.zip \
--publish
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
.idea
node_modules
yarn-debug.log*
yarn-error.log*
.DS_Store
.env
.tap

# Swap the comments on the following lines if you wish to use zero-installs
# In that case, don't forget to run `yarn config set enableGlobalCache false`!
# Documentation here: https://yarnpkg.com/features/caching#zero-installs

#!.yarn/cache
.pnp.*
dist
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v20.10.0
74 changes: 74 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Contributor Covenant Code of Conduct

## Our Pledge

In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to make participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
nationality, personal appearance, race, religion, or sexual identity and
orientation.

## Our Standards

Examples of behavior that contributes to creating a positive environment
include:

* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.

## Scope

This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at [email protected]. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at [http://contributor-covenant.org/version/1/4][version]

[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
Loading

0 comments on commit c72273d

Please sign in to comment.