chore: using env for tester key

This commit is contained in:
원더 2021-01-24 19:23:19 +09:00
parent 79aa4f9159
commit 994ea56af7
2 changed files with 1 additions and 8 deletions

View File

@ -16,11 +16,6 @@ COPY . /usr/src/app
RUN printf "NEXT_PUBLIC_COMMIT_HASH=$(git rev-parse HEAD)\nNEXT_PUBLIC_BRANCH=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')" > .env.local
# secret.json
RUN echo "{\"tester\": \"${TESTER_KEY}\"}" > secret.json
# Building app
RUN yarn build

View File

@ -9,8 +9,6 @@ const Navbar = dynamic(()=> import('@components/Navbar'))
import Crypto from 'crypto'
import secret from '../secret.json'
import 'core-js/es/promise'
import 'core-js/es/set'
import 'core-js/es/map'
@ -65,7 +63,7 @@ export default function App({ Component, pageProps }: AppProps): JSX.Element {
<Navbar />
<div className='iu-is-the-best h-full text-black dark:text-gray-100 dark:bg-discord-dark bg-white'>
{
secret.tester === Crypto.createHmac('sha256', betaKey ?? '').digest('hex') ? <Component {...pageProps} /> : <div className='text-center py-40 px-10'>
process.env.NEXT_PUBLIC_TESTER_KEY === Crypto.createHmac('sha256', betaKey ?? '').digest('hex') ? <Component {...pageProps} /> : <div className='text-center py-40 px-10'>
<h1 className='text-3xl font-bold'> .</h1><br/>
<input value={betaKey} name='field_name' className='text-black border outline-none px-4 py-2 rounded-2xl' type='text' placeholder='테스터 키' onChange={(e)=> { localStorage.setItem('betaKey', e.target.value); setBetaKey(e.target.value) }} />
</div>