From 450a98649429d496e1cb519b924f0d8438eaaf68 Mon Sep 17 00:00:00 2001 From: Jesse James Isler Date: Fri, 10 Jun 2022 07:56:30 +0200 Subject: [PATCH] added token and tokenreplacement on jenkins end --- .env | 1 + .gitignore | 3 +-- Jenkinsfile | 10 ++++++++++ index.js | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 .env diff --git a/.env b/.env new file mode 100644 index 0000000..2acce09 --- /dev/null +++ b/.env @@ -0,0 +1 @@ +CLIENT_TOKEN=((YourToken)) diff --git a/.gitignore b/.gitignore index 6a7d6d8..6f747cc 100644 --- a/.gitignore +++ b/.gitignore @@ -73,7 +73,6 @@ web_modules/ .yarn-integrity # dotenv environment variable files -.env .env.development.local .env.test.local .env.production.local @@ -127,4 +126,4 @@ dist .yarn/unplugged .yarn/build-state.yml .yarn/install-state.gz -.pnp.* \ No newline at end of file +.pnp.* diff --git a/Jenkinsfile b/Jenkinsfile index 84bcec3..c5d5e0b 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,7 +3,17 @@ pipeline { tools { nodejs "node" } + + environment { + TOKEN = credentials('schedulord-token') + } + stages { + stage('Replace Keys') { + steps { + sh("sed -i 's/((YourToken))/$TOKEN/g' .env") + } +} stage('NPM Install') { steps { sh 'npm install' diff --git a/index.js b/index.js index 7cafc43..f82dcf5 100644 --- a/index.js +++ b/index.js @@ -25,4 +25,4 @@ client.on('message', async msg => { //make sure this line is the last line -client.login(process.env.CLIENT_TOKEN); //login bot using token \ No newline at end of file +client.login(process.env.CLIENT_TOKEN); //login bot using token