[examples] Set public key from environment variable (#291)
* use env variables in example * add .env.local to gitignore
This commit is contained in:
parent
f59b38a3e4
commit
269586b6e9
|
@ -60,6 +60,7 @@ node_modules/
|
||||||
# dotenv environment variables file
|
# dotenv environment variables file
|
||||||
.env
|
.env
|
||||||
.env.test
|
.env.test
|
||||||
|
.env.local
|
||||||
|
|
||||||
# parcel-bundler cache (https://parceljs.org/)
|
# parcel-bundler cache (https://parceljs.org/)
|
||||||
.parcel-cache
|
.parcel-cache
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
PUBLIC_KEY=""
|
|
@ -2,6 +2,14 @@ import React from 'react'
|
||||||
|
|
||||||
import { Community } from '@status-im/react'
|
import { Community } from '@status-im/react'
|
||||||
|
|
||||||
export const App = () => {
|
const publicKey = process.env.PUBLIC_KEY
|
||||||
return <Community publicKey="<YOUR_COMMUNITY_KEY>" theme="light" />
|
|
||||||
|
if (!publicKey) {
|
||||||
|
throw new Error(
|
||||||
|
'Add PUBLIC_KEY to your environment variables (see .env.example)'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
export const App = () => {
|
||||||
|
return <Community publicKey={publicKey} theme="light" />
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue