Skip to content

Commit

Permalink
Merge pull request #158 from radio4000/feat/env-vars
Browse files Browse the repository at this point in the history
use .env for supabase url and key
  • Loading branch information
4www authored Apr 18, 2024
2 parents 9a609b2 + 29f6ba1 commit 8e0ecc3
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SUPABASE_URL=https://oupgudlkspsmzkmeovlh.supabase.co
SUPABASE_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Im91cGd1ZGxrc3BzbXprbWVvdmxoIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MTM0NTIwNzQsImV4cCI6MjAyOTAyODA3NH0.KAbKFBChJHtxTmOZM2pdeppIyNbcnQkEgSi6RA7OQdo
4 changes: 4 additions & 0 deletions .github/workflows/publish-to-npm-registry.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set env
run: |
echo "VITE_SUPABASE_URL=$SUPABASE_URL" >> $GITHUB_ENV
echo "VITE_SUPABASE_KEY=$SUPABASE_KEY" >> $GITHUB_ENV
- uses: actions/setup-node@v3
- run: npm ci
- run: npm run build
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: Deploy static content to Pages
on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
branches: ['main']

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand All @@ -17,7 +17,7 @@ permissions:

# Allow one concurrent deployment
concurrency:
group: "pages"
group: 'pages'
cancel-in-progress: true

jobs:
Expand All @@ -30,6 +30,10 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set env
run: |
echo "VITE_SUPABASE_URL=$SUPABASE_URL" >> $GITHUB_ENV
echo "VITE_SUPABASE_KEY=$SUPABASE_KEY" >> $GITHUB_ENV
- uses: actions/setup-node@v3
- run: npm install
- run: npm run build
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.env

# Logs
logs
*.log
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import components from './components/index.js'
import './index.css'

export {sdk, SUPABASE_URL, SUPABASE_KEY} from "./libs/sdk.js"
export default {...components}
10 changes: 4 additions & 6 deletions src/libs/sdk.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import {createClient} from '@supabase/supabase-js'
import {createSdk} from '@radio4000/sdk'

// Temporarily hard-coded to the "migration-test" project on Supabase.
// Yes, this key is meant to be public.
const key =
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InRxaHdzeGJzamx6Yml3cmVyYXRjIiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTg1NzE4MjUsImV4cCI6MjAxNDE0NzgyNX0.utV_0mI-k-EcTPlwMFHhNxB0nlvOY-Srx05Mr7EHJcQ'
const url = 'https://tqhwsxbsjlzbiwreratc.supabase.co'
const supabase = createClient(url, key)
export const SUPABASE_URL = import.meta.env.VITE_SUPABASE_URL
export const SUPABASE_KEY = import.meta.env.VITE_SUPABASE_KEY

const supabase = createClient(SUPABASE_URL, SUPABASE_KEY)

export const sdk = createSdk(supabase)

0 comments on commit 8e0ecc3

Please sign in to comment.