Getting started
Running on your machine
git clone https://github.com/nearform/optic.git && cd optic
npm i
npm run dev:env
- in the generated
.env
file, insert values (Do not use quotes, if you intend to use the same file for dockerized deployment):FIREBASE_CLIENT_EMAIL
is your Firebase client email generated along with the private keyFIREBASE_PRIVATE_KEY_BASE64
is your Firebase private key, base64 encoded to avoid new linesFIREBASE_PROJECT_ID
is your Firebase project id
npm run dev
Running on Docker
- Build:
docker build -t nearform/optic:latest .
- Generate the
.env
file using the steps from setup - Run:
docker run --env-file .env --expose 3001 nearform/optic:latest
Usage
- Log in the application
- Add your secret, by scanning npm's QR code, or providing the secret key manually
- Generate a token and save it in CI as environment variable named
OTP_TOKEN
- Update npm registry with your npm token
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
- Use CURL to get OTP token and publish package
npm publish --otp $(curl -s http://localhost:3000/api/generate/$OTP_TOKEN)