Skip to content

Commit

Permalink
Use .justfix-env for env vars to avoid conflict w/ pipenv.
Browse files Browse the repository at this point in the history
  • Loading branch information
toolness committed Aug 14, 2018
1 parent 015d2f6 commit 9d21532
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 5 deletions.
1 change: 0 additions & 1 deletion .env.sample

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ lambda.js.map
.mypy_cache/
.pytest_cache/
.env
.justfix-env
.coverage
node_modules/
frontend/static/frontend/*.js
Expand Down
7 changes: 7 additions & 0 deletions .justfix-env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Turning DEBUG on will ensure a good developer experience
# and make it so you don't have to configure a bunch of
# other settings.
DEBUG=true

# The only other valid value for this is 'production'.
NODE_ENV=development
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,14 @@ This is an attempt at creating a new Tenants app for JustFix.

You'll need Python 3.7 and [pipenv][], as well as Node 8.

First, set up the front-end and configure it to
First create an environment file and optionally edit it as you
see fit:

```
cp .justfix-env.sample .justfix-env
```

Then set up the front-end and configure it to
continuously re-build itself as you change the source code:

```
Expand Down Expand Up @@ -66,6 +73,11 @@ python manage.py envhelp
Alternatively, you can examine
[project/justfix_environment.py](project/justfix_environment.py).

For the Node front-end, the only environment variable that
matters right now is `NODE_ENV`, which can be set to
`production` for production or any other value for
development.

## GraphQL

The communication between server and client occurs via [GraphQL][]
Expand Down
9 changes: 9 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
},
"homepage": "https://github.com/justfixnyc/tenants2#readme",
"devDependencies": {
"@types/dotenv": "^4.0.3",
"@types/enzyme": "^3.1.13",
"@types/enzyme-adapter-react-16": "^1.0.3",
"@types/jest": "^23.3.1",
Expand Down
2 changes: 1 addition & 1 deletion project/justfix_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class JustfixTestingEnvironment(JustfixEnvironment):


def get() -> JustfixEnvironment:
dotenv.load_dotenv(BASE_DIR / '.env')
dotenv.load_dotenv(BASE_DIR / '.justfix-env')
if IS_RUNNING_TESTS:
return JustfixTestingEnvironment(exit_when_invalid=True)
is_debug = typed_environ.Converters.convert_bool(
Expand Down
7 changes: 5 additions & 2 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
const path = require('path');
const nodeExternals = require('webpack-node-externals');

// dotenv is a dev dependency, so no biggie if it can't be found.
try { require('dotenv').config(); } catch (e) { }
try {
require('dotenv').config({ path: path.join(__dirname, '.justfix-env') });
} catch (e) {
// dotenv is a dev dependency, so no biggie if it can't be found.
}

const IS_PRODUCTION = process.env.NODE_ENV === 'production';

Expand Down

0 comments on commit 9d21532

Please sign in to comment.