Skip to content

Commit

Permalink
readme cleanup and add DATA_API_TABLES to .env.example
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Nov 14, 2024
1 parent 243c15a commit c4f5f4e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 45 deletions.
2 changes: 2 additions & 0 deletions discord-bot/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ DATA_API_URI=http://127.0.0.1:8181/v1/discordbot
DATA_API_AUTH_USERNAME=cassandra
DATA_API_AUTH_PASSWORD=cassandra
DATA_API_AUTH_URL=http://localhost:8081/v1/auth
#Uncomment the following to enable API tables
#DATA_API_TABLES=true

#Fill the ASTRA DB related details only when IS_ASTRA is set to 'true'
#IS_ASTRA=true
Expand Down
13 changes: 1 addition & 12 deletions discord-bot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,4 @@ Below is a screenshot demonstrating executing each of the commands.

![image](https://user-images.githubusercontent.com/1620265/213293087-53505a73-3038-4db8-b21b-d9149a5396ed.png)

Anytime you add or update commands in the command folder, run step 3 again.

## With tables

Create table:

```
CREATE TABLE bots (
"_id" text,
name text,
PRIMARY KEY ("_id"));
```
Anytime you add or update commands in the command folder, run step 3 again.
6 changes: 4 additions & 2 deletions netlify-functions-ecommerce/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@
# false - if not connecting to an AstraDB and connecting to a local/remote jsonapi instead
IS_ASTRA=

#Fill the JSON API related details only when IS_ASTRA is set to 'false'
#Local JSON API URL for example: http://127.0.0.1:8181/v1/ecommerce_test where 'ecommerce_test' is the keyspace name
#Fill the Data API related details only when IS_ASTRA is set to 'false'
#Local Data API URL for example: http://127.0.0.1:8181/v1/ecommerce_test where 'ecommerce_test' is the keyspace name
DATA_API_URI=http://127.0.0.1:8181/v1/ecommerce_test
#Auth URL for example: http://127.0.0.1:8081/v1/auth
DATA_API_AUTH_URL=http://127.0.0.1:8081/v1/auth
#Auth username and password
DATA_API_AUTH_USERNAME=cassandra
DATA_API_AUTH_PASSWORD=cassandra
#Uncomment the following to enable API tables
#DATA_API_TABLES=true

#Fill the ASTRA DB related details only when IS_ASTRA is set to 'true'
#Astra DB API URL
Expand Down
34 changes: 3 additions & 31 deletions netlify-functions-ecommerce/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@ Other tools include:
Make sure you have a local stargate instance running as described on the [main page](../README.md) of this repo.

## Running This Example
### Setting up .env file to run against JSON API
### Setting up .env file to run against Data API
1. Copy the `.env.example` file to `.env` and fill in the values for the environment variables.
2. Set `IS_ASTRA` to `false`
3. Set `DATA_API_URI` to `http://127.0.0.1:8181/v1/ecommerce_test`
4. Set `DATA_API_AUTH_URI` to `http://127.0.0.1:8081/v1/auth`
5. Set `DATA_API_AUTH_USERNAME` to `cassandra`
6. Set `DATA_API_AUTH_PASSWORD` to `cassandra`
7. Remove `ASTRA_DB_ID`, `ASTRA_DB_REGION`, `ASTRA_DB_KEYSPACE`, `ASTRA_DB_APPLICATION_TOKEN`
8. (Optional) Set `DATA_API_TABLES=true` to make stargate-mongoose set the `Feature-Flag-tables` headers to enable API tables

### Setting up .env file to run against AstraDB
1. Copy the `.env.example` file to `.env` and fill in the values for the environment variables.
Expand All @@ -34,7 +35,7 @@ Make sure you have a local stargate instance running as described on the [main p
1. Run `npm install`
2. Run `npm run seed` to create all collections and insert sample data
3. Run `npm run build` to compile the frontend
4. (Optional) set `STRIPE_SECRET_KEY` to a test Stripe API key in your `.env` file. This will allow you to enable Stripe checkout.
4. (Optional) set `STRIPE_SECRET_KEY` to a test Stripe API key in your `.env` file. This will allow you to enable Stripe checkout. Or set `STRIPE_SECRET_KEY` to `test` to skip Stripe scheckout
5. Run `npm start`
Run `npm run test:smoke` to run a smoke test against `http://127.0.0.1:8888` that creates a cart using [Axios](https://masteringjs.io/axios).
6. Visit `http://127.0.0.1:8888/` to see the UI
Expand Down Expand Up @@ -70,33 +71,4 @@ Using test


8 passing (112ms)
```


## With tables

```
CREATE TABLE products (
"_id" text,
name text,
price decimal,
image text,
description text,
PRIMARY KEY ("_id"));
CREATE TABLE orders (
"_id" text,
total decimal,
name text,
"paymentMethod" text,
items text,
PRIMARY KEY ("_id"));
CREATE TABLE carts (
"_id" text,
items text,
"orderId" text,
total decimal,
"stripeSessionId" text,
PRIMARY KEY ("_id"));
```
2 changes: 2 additions & 0 deletions typescript-express-reviews/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ DATA_API_AUTH_URL=http://127.0.0.1:8081/v1/auth
#Auth username and password
DATA_API_AUTH_USERNAME=cassandra
DATA_API_AUTH_PASSWORD=cassandra
#Uncomment the following to enable API tables
#DATA_API_TABLES=true

#Fill the ASTRA DB related details only when IS_ASTRA is set to 'true'
#Astra DB API URL
Expand Down

0 comments on commit c4f5f4e

Please sign in to comment.