Skip to content

Commit

Permalink
netlify: Add multiple users & passwords
Browse files Browse the repository at this point in the history
Add placeholder users/passwords to netlify.toml that are replaced
by the environment variables stored in Netlify by running `netlify build`
or `netlify deploy --build`. Included instructions for deployment to
Netlify within the auspice README.
  • Loading branch information
joverlee521 committed Sep 24, 2021
1 parent 2a9bb63 commit 6248ca7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -89,3 +89,6 @@ Thumbs.db
# cluster log #
###############
*.sh.*

# Local Netlify folder
.netlify
7 changes: 6 additions & 1 deletion auspice/README.md
Expand Up @@ -12,7 +12,12 @@ Website for visualizing and interacting with phylogenies produced augur pipeline

### Deployment

Website is hosted on Amazon S3. Deploy with `s3_website push` from within the `auspice/` directory. This pushes the `_site/` directory to the specified S3 bucket. S3 credentials are stored in ENV as `S3_BUCKET`, `S3_KEY` and `S3_SECRET`. Environment variables can be updated locally without fear of committing private information.
Website is hosted on [Netlify](https://www.netlify.com/).
Use the [Netlify CLI](https://docs.netlify.com/cli/get-started/) to deploy the build by running:
```
netlify deploy --build --prod
```
__NOTE__: Be sure to include the `--build` option as this runs the build command within `netlify.toml` to replace the placeholder username and passwords with the environment variables set in Netlify.

### Local development

Expand Down
6 changes: 6 additions & 0 deletions auspice/netlify.toml
@@ -1,7 +1,13 @@
[build]
publish = "_site/"
command = "sed -i.bak \"s|USER1:PASSWORD1 USER2:PASSWORD2 USER3:PASSWORD3 USER4:PASSWORD4 USER5:PASSWORD5|${USER1}:${PASSWORD1} ${USER2}:${PASSWORD2} ${USER3}:${PASSWORD3} ${USER4}:${PASSWORD4} ${USER5}:${PASSWORD5}|g\" _site/netlify.toml && rm _site/netlify.toml.bak"

[[redirects]]
from = "/"
to = "/who/"
force = true

[[headers]]
for = "/*"
[headers.values]
Basic-Auth = "USER1:PASSWORD1 USER2:PASSWORD2 USER3:PASSWORD3 USER4:PASSWORD4 USER5:PASSWORD5"

0 comments on commit 6248ca7

Please sign in to comment.