Skip to content
44 changes: 44 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# ------------------------------------------------------------------------------
# OpenCRE Environment Configuration
# ------------------------------------------------------------------------------
# Copy this file to `.env` and update the values for your environment.
# Never commit your real `.env` file to version control.
# ------------------------------------------------------------------------------
# Database

DEV_DATABASE_URL=postgresql://user:password@localhost:5432/opencre

# Neo4j

NEO4J_URL=neo4j://neo4j:password@localhost:7687

# Redis

REDIS_HOST=localhost
REDIS_PORT=6379
REDIS_URL=redis://localhost:6379
REDIS_NO_SSL=false

# Flask

FLASK_CONFIG=development
INSECURE_REQUESTS=false

# Embeddings

NO_GEN_EMBEDDINGS=false

# Google Auth

GOOGLE_CLIENT_ID=your-client-id
GOOGLE_CLIENT_SECRET=your-client-secret
GOOGLE_SECRET_JSON=path/to/secret.json
LOGIN_ALLOWED_DOMAINS=example.com

# GCP

GCP_NATIVE=false

# Spreadsheet Auth

OpenCRE_gspread_Auth=path/to/credentials.json
37 changes: 21 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,23 +216,28 @@ make docker-dev

The environment variables used by OpenCRE are:

## Environment Configuration

Copy the example configuration file:

```bash
cp .env.example .env
```
- NEO4J_URL
- NO_GEN_EMBEDDINGS
- FLASK_CONFIG
- DEV_DATABASE_URL
- INSECURE_REQUESTS
- REDIS_HOST
- REDIS_PORT
- REDIS_NO_SSL
- REDIS_URL
- GCP_NATIVE
- GOOGLE_SECRET_JSON
- GOOGLE_CLIENT_ID
- GOOGLE_CLIENT_SECRET
- LOGIN_ALLOWED_DOMAINS
- OpenCRE_gspread_Auth
```

Then edit `.env` and provide values appropriate for your environment.

### Variables

* Database: `DEV_DATABASE_URL`
* Neo4j: `NEO4J_URL`
* Redis: `REDIS_HOST`, `REDIS_PORT`, `REDIS_URL`, `REDIS_NO_SSL`
* Flask: `FLASK_CONFIG`, `INSECURE_REQUESTS`
* Embeddings: `NO_GEN_EMBEDDINGS`
* Google Auth: `GOOGLE_CLIENT_ID`, `GOOGLE_CLIENT_SECRET`, `GOOGLE_SECRET_JSON`, `LOGIN_ALLOWED_DOMAINS`
* GCP: `GCP_NATIVE`
* Spreadsheet Auth: `OpenCRE_gspread_Auth`

See `.env.example` for full list and defaults.

You can run the containers with:

Expand Down
8 changes: 8 additions & 0 deletions cre.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@
import unittest
from typing import List

# NEW: load .env automatically for local development
try:
from dotenv import load_dotenv # type: ignore

load_dotenv()
except ImportError:
pass

import click # type: ignore
import coverage # type: ignore
from flask_migrate import Migrate # type: ignore
Expand Down