From 6e10cb3e09ec414b8b13a83f2edc39e71025186b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mu=C3=B1iz?= Date: Mon, 2 May 2022 17:41:59 +0200 Subject: [PATCH] =?UTF-8?q?Creaci=C3=B3n=20de=20variables=20en=20string?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pruebaDeploy.yml | 2 +- restapi/modules/cloudinary.ts | 16 ++++++++++------ restapi/modules/gestorDB.ts | 4 +++- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/pruebaDeploy.yml b/.github/workflows/pruebaDeploy.yml index bfe8470..bf02c18 100644 --- a/.github/workflows/pruebaDeploy.yml +++ b/.github/workflows/pruebaDeploy.yml @@ -69,4 +69,4 @@ jobs: MONGO_URI: ${{secrets.MONGO_URI}} CLOUDINARY_NAME: ${{secrets.CLOUD_NAME}} CLOUDINARY_API_KEY: ${{secrets.CLOUD_KEY}} - CLOUDINARY_API_SECRET: ${{secrets.CLOUD_SECRET}} + CLOUDINARY_API_SECRET: ${{secrets.CLOUD_SECRET}} \ No newline at end of file diff --git a/restapi/modules/cloudinary.ts b/restapi/modules/cloudinary.ts index 6cd9e67..cb921f5 100644 --- a/restapi/modules/cloudinary.ts +++ b/restapi/modules/cloudinary.ts @@ -1,23 +1,27 @@ const cloudinary = require('cloudinary').v2; require('dotenv').config() -/* +var name: string = process.env.CLOUDINARY_NAME || 'name' +var api_key:string = process.env.CLOUDINARY_API_KEY || 'key' +var secret:string = process.env.CLOUDINARY_API_SECRET || 'secret' + export function config(){ cloudinary.config({ - cloud_name : process.env.CLOUDINARY_NAME, - api_key : process.env.CLOUDINARY_API_KEY, - api_secret: process.env.CLOUDINARY_API_SECRET + cloud_name : name, + api_key : api_key, + api_secret: secret }); -}*/ +} +/* export function config(){ cloudinary.config({ cloud_name : 'dypp8pt31', api_key : '321597164512969', api_secret: 'sM2uhnqaS53Sq9_HsPDLK63FS7I' }); -} +}*/ export function configTest(){ diff --git a/restapi/modules/gestorDB.ts b/restapi/modules/gestorDB.ts index ec7e961..db0173b 100644 --- a/restapi/modules/gestorDB.ts +++ b/restapi/modules/gestorDB.ts @@ -2,8 +2,10 @@ const mongoose = require('mongoose') require('dotenv').config() +const mongo_uri:string = process.env.MONGO_URI || 'localhost' + export function connect(){ - mongoose.connect(process.env.MONGO_URI, { + mongoose.connect(mongo_uri, { useNewUrlParser: true, useUnifiedTopology: true })