Skip to content

Commit

Permalink
Merge pull request #453 from swrlab/dev/dts-remaining-onboarding
Browse files Browse the repository at this point in the history
feat: enable multiple user accounts for DTS plugin
  • Loading branch information
rafaelmaeuer authored Mar 27, 2023
2 parents ae345c5 + 2eb9972 commit 7bf6485
Show file tree
Hide file tree
Showing 84 changed files with 1,492 additions and 1,159 deletions.
42 changes: 42 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# docs: https://editorconfig.org
# please make sure to keep this file in sync between repositories
# to main file should be edited in `swr-prettier-config` and copied where needed

root = true

[*]
charset = utf-8
end_of_line = lf
indent_style = tab
indent_size = 8
print_width = 111
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false
indent_style = space
indent_size = 2

[*.{yml,yaml}]
indent_style = space
indent_size = 2

# LiquidSoap config files
[*.liq]
indent_style = space
indent_size = 2

# Terraform config files
[*.tf]
indent_style = space
indent_size = 2

# Linting toml config files
[*.toml]
indent_style = space
indent_size = 2

# Auto-generated CSV Files
[*.csv]
insert_final_newline = false
12 changes: 8 additions & 4 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,22 @@
# ard-eventhub
#

# Disable dotenv-linter quote character
# dotenv-linter:off QuoteCharacter

# set service name
SERVICE_NAME=ard-eventhub
SERVICE_NAME=ard-eventhub-ingest

# set node env
IS_LOCAL=true
# PORT=<custom-port>
STAGE=dev
#PORT=<custom-port>
#DEBUG=true

# set datadog tracing
DD_TRACE_ENABLED=false

# set auth
DTS_KEYS="<base64-of-key>"
FIREBASE_API_KEY=<firebase-api-key>
GOOGLE_APPLICATION_CREDENTIALS=./keys/ingest.json

Expand All @@ -24,4 +28,4 @@ PUBSUB_SERVICE_ACCOUNT_EMAIL_INTERNAL=<service-account-email>
# set test vars
TEST_USER=<test-user-email>
TEST_USER_PW=<test-user-password>
#TEST_USER_RESET=true
# TEST_USER_RESET=true
11 changes: 6 additions & 5 deletions .github/workflows/ingest-pull.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: 👀 Checkout Code
uses: actions/checkout@v3

- name: ⛺️ Install Node.js
- name: 🏗 Install Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
Expand All @@ -47,14 +47,15 @@ jobs:

- name: 🧪 Run Ingest Tests
env:
SERVICE_NAME: ard-eventhub
STAGE: ${{ matrix.STAGES }}
DD_TRACE_ENABLED: false
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
DTS_KEYS: ${{ secrets.TEST_DTS_KEYS }}
FIREBASE_API_KEY: ${{ secrets.TEST_FIREBASE_API_KEY }}
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
PUBSUB_SERVICE_ACCOUNT_EMAIL_INTERNAL: ${{ secrets.PUBSUB_SERVICE_ACCOUNT_EMAIL }}
SERVICE_NAME: ard-eventhub-ingest
STAGE: ${{ matrix.STAGES }}
TEST_USER: ${{ secrets.TEST_USER }}
TEST_USER_PW: ${{ secrets.TEST_USER_PW }}
PUBSUB_SERVICE_ACCOUNT_EMAIL_INTERNAL: ${{ secrets.PUBSUB_SERVICE_ACCOUNT_EMAIL }}
run: yarn ingest:test

license:
Expand Down
24 changes: 11 additions & 13 deletions .github/workflows/ingest-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ jobs:
- name: 👀 Checkout Code
uses: actions/checkout@v3

- name: ⛺️ Install Node.js
- name: 🏗 Install Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'
cache: "yarn"
cache-dependency-path: "**/yarn.lock"

- name: 📦 Install Dependencies
run: yarn
Expand All @@ -53,14 +53,15 @@ jobs:

- name: 🧪 Run Ingest Tests
env:
SERVICE_NAME: ard-eventhub
STAGE: ${{ matrix.STAGES }}
DD_TRACE_ENABLED: false
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
DTS_KEYS: ${{ secrets.TEST_DTS_KEYS }}
FIREBASE_API_KEY: ${{ secrets.TEST_FIREBASE_API_KEY }}
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
PUBSUB_SERVICE_ACCOUNT_EMAIL_INTERNAL: ${{ secrets.PUBSUB_SERVICE_ACCOUNT_EMAIL }}
SERVICE_NAME: ard-eventhub-ingest
STAGE: ${{ matrix.STAGES }}
TEST_USER: ${{ secrets.TEST_USER }}
TEST_USER_PW: ${{ secrets.TEST_USER_PW }}
PUBSUB_SERVICE_ACCOUNT_EMAIL_INTERNAL: ${{ secrets.PUBSUB_SERVICE_ACCOUNT_EMAIL }}
run: yarn ingest:test

docker:
Expand All @@ -77,14 +78,11 @@ jobs:
with:
credentials_json: ${{ secrets.GCP_GITHUB_SERVICE_ACCOUNT_KEY }}

- name: 🏗 Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v1

- name: 🔑 Login to Registry
run: 'gcloud auth configure-docker $REGISTRY_DOMAIN'
run: "gcloud auth configure-docker $REGISTRY_DOMAIN"

- name: 🚧 Building docker image
run: 'docker build ./ --file ./Dockerfile -t image'
run: "docker build ./ --file ./Dockerfile -t image"

- name: 🔖 Get Package Version
id: package-version
Expand Down Expand Up @@ -132,7 +130,7 @@ jobs:
```
- name: 👋 Logout
run: 'docker logout'
run: "docker logout"

deploy-A-dev-kubernetes:
if: github.event.pull_request.merged == true
Expand Down
19 changes: 19 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Linter

on:
workflow_dispatch:
pull_request:
branches-ignore:
- dependabot/**

permissions:
contents: read
statuses: write

jobs:
lint:
uses: swrlab/node-utils/.github/workflows/linter.yml@main
with:
install-all: false
log-level: "NOTICE"
validate-all-codebase: false
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ yarn-error.log*
.DS_STORE

# keys
keys/*.json
keys/
.env

# Dependency directories
Expand Down
2 changes: 1 addition & 1 deletion .license-compliancerc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//
// ard-eventhub
// by SWR audio lab
// by SWR Audio Lab
//

// This helper runs the license-compliance toolkit using
Expand Down
35 changes: 35 additions & 0 deletions .markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# see config https://github.com/DavidAnson/markdownlint#optionsconfig
# see example file https://github.com/DavidAnson/markdownlint/blob/main/schema/.markdownlint.yaml
# see rules https://github.com/markdownlint/markdownlint/blob/master/docs/RULES.md
# recommended VS Code plugin: https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint

# Default state for all rules
default: true

# Unordered list style
MD004: true

MD007:
# Unordered list indentation
indent: 2

# MD013/line-length - Line length
MD013:
# Number of characters
line_length: 808

MD026:
# List of not allowed
punctuation: '.,;:!。,;:'

# Ordered list item prefix
MD029: false

# Allow inline HTML
MD033: false

# Emphasis used instead of a heading
MD036: false

# Error on blank lines
blank_lines: false
30 changes: 22 additions & 8 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,28 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.5.0] - 2023-03-14

- fix: stop logging requests on dev
- fix: spelling of `SWR Audio Lab`
- fix: handle invalid format definition
- feat: add `IS_LOCAL` env for local-specific logs and actions
- feat: enable multiple user accounts for DTS plugin
- feat: add test for invalid timestamps
- feat: add custom attributes to pubsub messages
- refactor: move DTS keys from GCP Secrets to env
- refactor: move some event functions to utils
- refactor: replace `moment` with `luxon`
- refactor: remove info logging for sent pubsub events

## [1.4.1] - 2022-12-23

- chore: update `jsonwebtoken` to mitigate CVE-2022-23529

## [1.4.0] - 2022-11-24

- chore: update express-openapi-validator to `v5`
- chore: update google-github-actions to `v1`
- chore: update `express-openapi-validator` to `v5`
- chore: update `google-github-actions` to `v1`
- chore: refactor env check and add google-auth
- chore: add env var checks to mocha-tests
- chore: migrate GitHub Actions from `::set-output` to new format
Expand All @@ -35,18 +49,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- chore: update Node.js to `v18`
- chore: update node-utils to `v1.0.0`
- fix: resolve eslint errors
- fix: resolve ESLint errors
- fix: reorder core-dump (alphabetically institutions)
- feat: update docker version tag from `package.json`
- feat: add eslint check to github-actions
- feat: add ESLint check to GitHub Actions

## [1.3.6] - 2022-07-18

- chore: add publisherId to logs

## [1.3.5] - 2022-06-21

- update: github-actions to use latest versions
- update: GitHub Actions to use latest versions
- update: @google-cloud/secret-manager to `v4.0.0`
- update: @google-cloud/datastore to `v7.0.0`
- update: firebase-admin to `v11.0.0`
Expand Down Expand Up @@ -128,12 +142,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Add two missing MDR channels
- Update project dependencies
- Update github actions
- Update GitHub Actions

## [1.2.1] - 2021-11-16

- Update project dependencies
- Update github actions
- Update GitHub Actions

## [1.2.0] - 2021-10-19

Expand All @@ -147,7 +161,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [1.1.5] - 2021-09-27

- Update project dependencies
- Update github actions
- Update GitHub Actions

## [1.1.4] - 2021-09-13

Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ These ARD broadcasters are currently sending live metadata via ARD Eventhub:

| Broadcaster | TEST | PROD |
| ---------------- | ---- | ---- |
| BR | | |
| HR | | |
| MDR | - | |
| NDR | | |
| Radio Bremen | - | |
| RBB | - | |
| SR | - | |
| SWR | | |
| WDR | | |
| BR |||
| HR |||
| MDR | - ||
| NDR |||
| Radio Bremen | - ||
| RBB | - ||
| SR | - ||
| SWR |||
| WDR |||
| Deutschlandradio | - | - |

## Get Started and Documentation
Expand Down Expand Up @@ -82,7 +82,7 @@ This source code is provided under EUPL v1.2, except for the [`spdx-exceptions`]
| NPM | `firebase-admin` | [Apache License 2.0](https://github.com/firebase/firebase-admin-node/blob/master/LICENSE) |
| NPM | `google-auth-library` | [Apache License 2.0](https://github.com/googleapis/google-auth-library-nodejs/blob/master/LICENSE) |
| NPM | `jsonwebtoken` | [MIT](https://github.com/auth0/node-jsonwebtoken/blob/master/LICENSE) |
| NPM | `moment` | [MIT](https://github.com/moment/moment/blob/develop/LICENSE) |
| NPM | `luxon` | [MIT](https://github.com/moment/luxon/blob/master/LICENSE.md) |
| NPM | `slug` | [MIT](https://github.com/Trott/slug/blob/master/LICENSE) |
| NPM | `swagger-ui-express` | [MIT](https://github.com/scottie1984/swagger-ui-express/blob/master/LICENSE) |
| NPM | `uuid` | [MIT](https://github.com/uuidjs/uuid/blob/master/LICENSE.md) |
Expand Down
6 changes: 6 additions & 0 deletions config/dtsKeys.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// fetch and convert env
const keys = Buffer.from(process.env.DTS_KEYS, 'base64').toString('utf8')
const decoded = JSON.parse(keys)

// export content
module.exports = decoded
Loading

0 comments on commit 7bf6485

Please sign in to comment.