Skip to content

Commit

Permalink
Merge pull request #99 from open-template-hub/develop
Browse files Browse the repository at this point in the history
Release/mq
  • Loading branch information
furknyavuz authored Sep 28, 2021
2 parents cdcb18f + ff9971b commit 823bf9d
Show file tree
Hide file tree
Showing 23 changed files with 546 additions and 604 deletions.
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2

updates:
- package-ecosystem: 'npm'
directory: '/'
schedule:
interval: 'weekly'
day: 'monday'
time: '08:00'
timezone: 'Etc/GMT'
target-branch: 'workflow/dependency-update'
labels:
- 'workflow'
milestone: 1
34 changes: 34 additions & 0 deletions .github/workflows/cron-dependency-checker-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Cron Dependency Checker Workflow

on:
schedule:
- cron: '0 4 * * 1'

jobs:
cron-dependency-checker:
name: 'Cron Dependency Checker'
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v2
with:
token: ${{ secrets.MASTER_BRANCH_ACCESS_TOKEN }}

- name: Install Node
uses: actions/setup-node@v1
with:
node-version: 12

- name: NPM Install
run: npm i
- name: Npm Outdated
run: npm run outdated
- name: Build
run: npm run buildProd

- name: Git Commit and Push
run: |
git config --global user.email "furknyavuz@gmail.com"
git config --global user.name "Furkan Yavuz"
git commit -am "Workflow/dependency check"
git push
2 changes: 1 addition & 1 deletion .github/workflows/issue-assigned-workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
automate-project-columns:
name: "Automate Project Columns"
name: 'Automate Project Columns'
runs-on: ubuntu-latest

steps:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/on-push-tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ on:

jobs:
tagged-release:
name: "Tagged Release"
runs-on: "ubuntu-latest"
name: 'Tagged Release'
runs-on: 'ubuntu-latest'

steps:
- name: Generate Release From Tag
uses: "marvinpinto/action-automatic-releases@latest"
uses: 'marvinpinto/action-automatic-releases@latest'
with:
repo_token: "${{ secrets.MASTER_BRANCH_ACCESS_TOKEN }}"
repo_token: '${{ secrets.MASTER_BRANCH_ACCESS_TOKEN }}'
prerelease: false
25 changes: 0 additions & 25 deletions .github/workflows/on-push-to-master.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/on-version-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ on:
paths-ignore:
- 'package.json'
branches:
- "master"
- 'master'

jobs:
bump-version:
name: "Update Version"
name: 'Update Version'
runs-on: ubuntu-latest

steps:
Expand All @@ -30,7 +30,7 @@ jobs:
token: ${{ secrets.MASTER_BRANCH_ACCESS_TOKEN }}

create-version-update-pr:
name: "Create Version Update PR"
name: 'Create Version Update PR'
runs-on: ubuntu-latest
needs: bump-version

Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/pr-labeled-at-develop-workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ on:

jobs:
auto-merge:
name: "Auto Merge"
name: 'Auto Merge'
runs-on: ubuntu-latest
steps:
- name: automerge
uses: "pascalgn/automerge-action@v0.14.3"
uses: 'pascalgn/automerge-action@v0.14.3'
env:
GITHUB_TOKEN: "${{ secrets.MASTER_BRANCH_ACCESS_TOKEN }}"
MERGE_LABELS: "workflow"
MERGE_COMMIT_MESSAGE: "Auto merge for PR with workflow label"
MERGE_FORKS: "false"
MERGE_RETRY_SLEEP: "60000"
GITHUB_TOKEN: '${{ secrets.MASTER_BRANCH_ACCESS_TOKEN }}'
MERGE_LABELS: 'workflow'
MERGE_COMMIT_MESSAGE: 'Auto merge for PR with workflow label'
MERGE_FORKS: 'false'
MERGE_RETRY_SLEEP: '60000'
4 changes: 2 additions & 2 deletions .github/workflows/pr-open-to-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:

jobs:
reset-demo-from-develop:
name: "Reset Demo From Develop"
name: 'Reset Demo From Develop'
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
Expand All @@ -19,5 +19,5 @@ jobs:
- name: Hard Reset Demo From Develop
run: |
git fetch origin develop:develop
git reset --hard develop
git reset --hard origin/develop
git push -f
7 changes: 4 additions & 3 deletions .github/workflows/pr-open-workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ name: PR Open Workflows
on:
pull_request:
types: [ opened ]
branches-ignore: [ 'workflow/dependency-update' ]

jobs:
pr-labeler:
name: "Add Label to PR"
name: 'Add Label to PR'
runs-on: ubuntu-latest

steps:
Expand All @@ -16,7 +17,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.MASTER_BRANCH_ACCESS_TOKEN }}

automate-project-columns:
name: "Automate Project Columns"
name: 'Automate Project Columns'
runs-on: ubuntu-latest

steps:
Expand All @@ -28,7 +29,7 @@ jobs:
repo-token: ${{ secrets.MASTER_BRANCH_ACCESS_TOKEN }}

milestone-binder:
name: "Milestone Binder"
name: 'Milestone Binder'
runs-on: ubuntu-latest

steps:
Expand Down
17 changes: 17 additions & 0 deletions .run/env.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="env" type="ShConfigurationType">
<option name="SCRIPT_TEXT" value="" />
<option name="INDEPENDENT_SCRIPT_PATH" value="true" />
<option name="SCRIPT_PATH" value="$PROJECT_DIR$/env.sh" />
<option name="SCRIPT_OPTIONS" value="" />
<option name="INDEPENDENT_SCRIPT_WORKING_DIRECTORY" value="true" />
<option name="SCRIPT_WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="INDEPENDENT_INTERPRETER_PATH" value="true" />
<option name="INTERPRETER_PATH" value="/bin/bash" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="EXECUTE_IN_TERMINAL" value="true" />
<option name="EXECUTE_SCRIPT_FILE" value="true" />
<envs />
<method v="2" />
</configuration>
</component>
9 changes: 9 additions & 0 deletions .run/outdated.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="outdated" type="js.build_tools.npm">
<package-json value="$PROJECT_DIR$/package.json" />
<command value="outdated" />
<node-interpreter value="project" />
<envs />
<method v="2" />
</configuration>
</component>
9 changes: 9 additions & 0 deletions .run/update.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="update" type="js.build_tools.npm">
<package-json value="$PROJECT_DIR$/package.json" />
<command value="update" />
<node-interpreter value="project" />
<envs />
<method v="2" />
</configuration>
</component>
40 changes: 20 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,39 +57,39 @@ Check project's current **nodejs** and **npm** version from **[package.json](pac
If you don't give **RESPONSE_ENCRYPTION_SECRET**, response encryption mechanism will be disabled automatically.

```applescript
PORT={Port}
PORT=4001
ACCESS_TOKEN_EXPIRE=1hour
ACCESS_TOKEN_SECRET={Access Token Secret}
PROJECT=OTH
MODULE=AuthServer
ENVIRONMENT=Local
CLIENT_RESET_PASSWORD_URL=/reset-password
CLIENT_URL=http://localhost:4200
CLIENT_VERIFICATION_SUCCESS_URL=/verify-account
CLIENT_RESET_PASSWORD_URL=http://localhost:4200/reset-password
CLIENT_VERIFICATION_SUCCESS_URL=http://localhost:4200/verify-account
DATABASE_URL={Database Connection Url}
POSTGRESQL_CONNECTION_LIMIT={Postgresql Connection Limit}
MAIL_HOST={SMTP Host}
MAIL_PASSWORD={Mail Password}
MAIL_PORT={SMTP Port}
MAIL_USERNAME={Mail Address}
CLOUDAMQP_APIKEY={MQ Api Key}
CLOUDAMQP_URL={MQ Connection Url}
REFRESH_TOKEN_EXPIRE=30days
REFRESH_TOKEN_SECRET={Refresh Token Secret}
AUTH_SERVER_QUEUE_CHANNEL=oth_auth_queue
ORCHESTRATION_SERVER_QUEUE_CHANNEL=oth_orchestration_queue
RESET_PASSWORD_TOKEN_EXPIRE=1day
RESET_PASSWORD_TOKEN_SECRET={Reset Password Token Secret}
RESPONSE_ENCRYPTION_SECRET={Response Encryption Secret}
AUTO_VERIFY=false
VERIFICATION_TOKEN_SECRET={Verification Token Secret}
ACCESS_TOKEN_EXPIRE=1hour
ACCESS_TOKEN_SECRET={Access Token Secret}
AUTO_VERIFY={Set true If Auto Verify On SignUp}
REFRESH_TOKEN_EXPIRE=30days
REFRESH_TOKEN_SECRET={Refresh Token Secret}
POSTGRESQL_CONNECTION_LIMIT={PostgreSQL Connection Limit In Pool}
RESET_PASSWORD_TOKEN_EXPIRE=1day
RESET_PASSWORD_TOKEN_SECRET={Reset Token Secret}
MAIL_SERVER_DISABLED={Set true If Mail server disabled}
VERIFICATION_TOKEN_SECRET={Verification Token Secret
ORCHESTRATION_SERVER_QUEUE_CHANNEL= {Orchestration Server MQ Channel Name}
RESPONSE_ENCRYPTION_SECRET={Response Encryption Secret}
```

## Social Login Configurations
Expand Down
56 changes: 56 additions & 0 deletions app/consumer/auth-queue.consumer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { AuthActionType } from '@open-template-hub/common';

export class AuthQueueConsumer {
constructor(private channel: any) {}

onMessage = async (msg: any) => {
if (msg !== null) {
const msgStr = msg.content.toString();
const msgObj = JSON.parse(msgStr);

const message: AuthActionType = msgObj.message;

// Decide requeue in the error handling
let requeue = false;

if (message.example) {
var exampleHook = async () => {
console.log('Auth server example');
};

await this.operate(msg, msgObj, requeue, exampleHook);
} else {
console.log('Message will be rejected: ', msgObj);
this.channel.reject(msg, false);
}
}
};

private operate = async (
msg: any,
msgObj: any,
requeue: boolean,
hook: Function
) => {
try {
console.log(
'Message Received with deliveryTag: ' + msg.fields.deliveryTag,
msgObj
);
await hook();
await this.channel.ack(msg);
console.log(
'Message Processed with deliveryTag: ' + msg.fields.deliveryTag,
msgObj
);
} catch (e) {
console.log(
'Error with processing deliveryTag: ' + msg.fields.deliveryTag,
msgObj,
e
);

this.channel.nack(msg, false, requeue);
}
};
}
Loading

0 comments on commit 823bf9d

Please sign in to comment.