removing firebase functions....going to do gcp instead and have containers easy with cloud run
This commit is contained in:
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"projects": {
|
||||
"default": "nirvana-v3"
|
||||
}
|
||||
}
|
||||
@@ -1,66 +0,0 @@
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
firebase-debug.log*
|
||||
firebase-debug.*.log*
|
||||
|
||||
# Firebase cache
|
||||
.firebase/
|
||||
|
||||
# Firebase config
|
||||
|
||||
# Uncomment this if you'd like others to create their own Firebase project.
|
||||
# For a team working on the same Firebase project(s), it is recommended to leave
|
||||
# it commented so all members can deploy to the same project(s) in .firebaserc.
|
||||
# .firebaserc
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (http://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"functions": {
|
||||
"predeploy": [
|
||||
"npm --prefix \"$RESOURCE_DIR\" run lint",
|
||||
"npm --prefix \"$RESOURCE_DIR\" run build"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
module.exports = {
|
||||
root: true,
|
||||
env: {
|
||||
es6: true,
|
||||
node: true,
|
||||
},
|
||||
extends: [
|
||||
'eslint:recommended',
|
||||
'plugin:import/errors',
|
||||
'plugin:import/warnings',
|
||||
'plugin:import/typescript',
|
||||
// 'google',
|
||||
'plugin:@typescript-eslint/recommended',
|
||||
],
|
||||
parser: '@typescript-eslint/parser',
|
||||
parserOptions: {
|
||||
project: ['./tsconfig.json', './tsconfig.dev.json'],
|
||||
sourceType: 'module',
|
||||
},
|
||||
ignorePatterns: [
|
||||
'/lib/**/*', // Ignore built files.
|
||||
],
|
||||
plugins: ['@typescript-eslint', 'import'],
|
||||
rules: {
|
||||
'import/no-unresolved': 0,
|
||||
},
|
||||
};
|
||||
@@ -1,9 +0,0 @@
|
||||
# Compiled JavaScript files
|
||||
lib/**/*.js
|
||||
lib/**/*.js.map
|
||||
|
||||
# TypeScript v1 declaration files
|
||||
typings/
|
||||
|
||||
# Node.js dependency directory
|
||||
node_modules/
|
||||
@@ -1,32 +0,0 @@
|
||||
{
|
||||
"name": "functions",
|
||||
"version": "1.0.0",
|
||||
"scripts": {
|
||||
"lint": "eslint --ext .js,.ts .",
|
||||
"build": "npm run lint && tsc",
|
||||
"serve": "npm run build && firebase emulators:start --only functions",
|
||||
"shell": "npm run build && firebase functions:shell",
|
||||
"start": "npm run shell",
|
||||
"deploy": "firebase deploy --only functions",
|
||||
"logs": "firebase functions:log"
|
||||
},
|
||||
"engines": {
|
||||
"node": "16"
|
||||
},
|
||||
"main": "lib/index.js",
|
||||
"dependencies": {
|
||||
"firebase-admin": "^9.8.0",
|
||||
"firebase-functions": "^3.14.1",
|
||||
"twilio": "^3.77.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@typescript-eslint/eslint-plugin": "^3.9.1",
|
||||
"@typescript-eslint/parser": "^3.8.0",
|
||||
"eslint": "^7.6.0",
|
||||
"eslint-config-google": "^0.14.0",
|
||||
"eslint-plugin-import": "^2.22.0",
|
||||
"firebase-functions-test": "^0.2.0",
|
||||
"typescript": "^3.8.0"
|
||||
},
|
||||
"private": true
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
export default class GetTwilioAccessTokenRequest {
|
||||
constructor(public roomName: string, public roomType: 'webrtc-go' | 'p2p-group' | 'group-room') {}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
export default class TwilioAccessToken {
|
||||
constructor(public token: string) {}
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
import * as functions from 'firebase-functions';
|
||||
import * as twilio from 'twilio';
|
||||
|
||||
import TwilioAccessToken from './core/functions/response/TwilioAccessToken.response';
|
||||
|
||||
const AccessToken = twilio.jwt.AccessToken;
|
||||
// // Start writing Firebase Functions
|
||||
// // https://firebase.google.com/docs/functions/typescript
|
||||
//
|
||||
|
||||
const VideoGrant = AccessToken.VideoGrant;
|
||||
|
||||
export const helloWorld = functions.https.onRequest((request, response) => {
|
||||
functions.logger.info('Hello logs!', { structuredData: true });
|
||||
response.send('Hello from Firebase!');
|
||||
});
|
||||
|
||||
export const getStreamToken = functions.https.onCall((data, context) => {
|
||||
// Used when generating any kind of tokens
|
||||
// To set up environmental variables, see http://twil.io/secure
|
||||
try {
|
||||
const twilioAccountSid = process.env.TWILIO_ACCOUNT_SID;
|
||||
const twilioApiKey = process.env.TWILIO_API_KEY;
|
||||
const twilioApiSecret = process.env.TWILIO_API_SECRET;
|
||||
|
||||
if (!twilioAccountSid || !twilioApiKey || !twilioApiSecret) {
|
||||
functions.logger.error('no twilio access tokens!!!');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const identity = context.auth?.uid ?? 'user';
|
||||
|
||||
// Create Video Grant
|
||||
const videoGrant = new VideoGrant();
|
||||
|
||||
// Create an access token which we will sign and return to the client,
|
||||
// containing the grant we just created
|
||||
const token = new AccessToken(twilioAccountSid, twilioApiKey, twilioApiSecret, {
|
||||
identity,
|
||||
});
|
||||
|
||||
token.addGrant(videoGrant);
|
||||
|
||||
functions.logger.info(`${context.auth?.uid} user granted a stream access token`);
|
||||
|
||||
// Serialize the token to a JWT string
|
||||
return new TwilioAccessToken(token.toJwt());
|
||||
} catch (error) {
|
||||
functions.logger.error(error);
|
||||
return undefined;
|
||||
}
|
||||
});
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"include": [
|
||||
".eslintrc.js"
|
||||
]
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"noImplicitReturns": true,
|
||||
"noUnusedLocals": true,
|
||||
"outDir": "lib",
|
||||
"sourceMap": true,
|
||||
"strict": true,
|
||||
"target": "es2017"
|
||||
},
|
||||
"compileOnSave": true,
|
||||
"include": ["src"],
|
||||
"exclude": ["**/.env"]
|
||||
}
|
||||
Reference in New Issue
Block a user