This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To address the security issue you're facing, you need to ensure that sensitive API details are not exposed to the frontend. Here’s a step-by-step guide to help you secure your application: | |
### 1. **Move Sensitive Logic to the Backend** | |
- **Create a Backend Service**: Since you're using Netlify, you can use Netlify Functions to create serverless functions that handle sensitive operations. These functions will run on the server-side, keeping your API keys and other sensitive information secure. | |
- **Environment Variables**: Store your API keys and sensitive information in environment variables. Netlify allows you to set environment variables in the build settings. | |
### 2. **Set Up Netlify Functions** | |
- **Create a Functions Directory**: In your project, create a directory named `netlify/functions` (if it doesn’t already exist). | |
- **Write Serverless Functions**: Create a new file for each function, e.g., `netlify/functions/generateContent.js`. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import instructor | |
import time | |
from langchain_community.vectorstores import FAISS | |
from langchain_openai import OpenAIEmbeddings | |
from langchain.text_splitter import TokenTextSplitter | |
from langchain_community.document_loaders import UnstructuredURLLoader | |
from openai import OpenAI | |
from pydantic import BaseModel |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import instructor | |
import time | |
from langchain_community.vectorstores import FAISS | |
from langchain_openai import OpenAIEmbeddings | |
from langchain.text_splitter import TokenTextSplitter | |
from langchain_community.document_loaders import UnstructuredURLLoader | |
from openai import OpenAI | |
from pydantic import BaseModel |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
client = boto3.client('ec2', region_name='us-east-1') | |
ec2_regions = [region['RegionName'] for region in client.describe_regions()['Regions']] | |
for region in ec2_regions: | |
conn = boto3.resource('ec2', region_name=region) | |
instances = conn.instances.filter() | |
ids = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ================== | |
// Utility code start | |
// ================== | |
var Readable = require('stream').Readable; | |
var util = require('util'); | |
/** | |
* Stream which returns numbers in ascending sorted order. | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Git Workflow | |
We want to closely monitor what gets merged down to `master` branches and keep | |
our commit history as clean as possible. To accomplish this we can employ a few best | |
practices to ensure we don't see large numbers of useless `merge` commits and in addition | |
to that it will keep the ordering of our commits with priority on merged work vs local | |
changes. | |
### Basic Assumptions |