Merge pull request #6417 from TokenChingy/feat/studio/defaults

feat/studio: Enable .env provisioned values for "Default Organization" and "Default Project"
This commit is contained in:
Terry Sutton authored and GitHub committed 2022-09-30 11:54:40 -02:30
commit 0d1c2a9873
11 files changed
+35 -12

No files matched your search

+3
View File
@@ -70,5 +70,8 @@ ENABLE_PHONE_AUTOCONFIRM=true
# Studio - Configuration for the Dashboard
############
STUDIO_ORGANIZATION_NAME=Default Organization
STUDIO_PROJECT_NAME=Default Project
STUDIO_PORT=3000
PUBLIC_REST_URL=http://localhost:8000/rest/v1/ # replace if you intend to use Studio outside of localhost
+3
View File
@@ -17,6 +17,9 @@ services:
STUDIO_PG_META_URL: http://meta:8080
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
DEFAULT_ORGANIZATION: ${STUDIO_DEFAULT_ORGANIZATION}
DEFAULT_PROJECT: ${STUDIO_DEFAULT_PROJECT}
SUPABASE_URL: http://kong:8000
SUPABASE_REST_URL: ${PUBLIC_REST_URL}
SUPABASE_ANON_KEY: ${ANON_KEY}
+3
View File
@@ -1,6 +1,9 @@
STUDIO_PG_META_URL=http://localhost:8000/pg
POSTGRES_PASSWORD=your-super-secret-and-long-postgres-password
DEFAULT_ORGANIZATION_NAME=Default Organization
DEFAULT_PROJECT_NAME=Default Project
SUPABASE_URL=http://localhost:8000
SUPABASE_REST_URL=http://localhost:8000/rest/v1/
SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyAgCiAgICAicm9sZSI6ICJhbm9uIiwKICAgICJpc3MiOiAic3VwYWJhc2UtZGVtbyIsCiAgICAiaWF0IjogMTY0MTc2OTIwMCwKICAgICJleHAiOiAxNzk5NTM1NjAwCn0.dc_X5iR_VP_qT0zsiyj_I_OZ2T9FtRU2BBNWN8Bu4GE
+7
View File
@@ -67,3 +67,10 @@ Then run the following commands to install dependencies and start the dashboard.
npm install
npm run dev
```
If you would like to configure different defaults for "Default Organization" and "Default Project", you will need to update the `.env` in the studio folder with the corresponding values.
```
DEFAULT_ORGANIZATION_NAME=
DEFAULT_PROJECT_NAME=
```
+3 -2
View File
@@ -1,6 +1,7 @@
import apiWrapper from 'lib/api/apiWrapper'
import { NextApiRequest, NextApiResponse } from 'next'
import apiWrapper from 'lib/api/apiWrapper'
export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler)
async function handler(req: NextApiRequest, res: NextApiResponse) {
@@ -20,7 +21,7 @@ const handleGetAll = async (req: NextApiRequest, res: NextApiResponse) => {
const response = [
{
id: 1,
name: 'Default Organization',
name: process.env.DEFAULT_ORGANIZATION_NAME || 'Default Organization',
slug: 'default-org-slug',
billing_email: 'billing@supabase.co',
},
+4 -3
View File
@@ -1,7 +1,8 @@
import { NextApiRequest, NextApiResponse } from 'next'
import { IS_PLATFORM } from 'lib/constants'
import { createEncryptedDbConnectionString } from 'lib/api/apiHelpers'
import apiWrapper from 'lib/api/apiWrapper'
import { createEncryptedDbConnectionString } from 'lib/api/apiHelpers'
export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler)
@@ -28,14 +29,14 @@ const handleGetAll = async (req: NextApiRequest, res: NextApiResponse) => {
organizations: [
{
id: 1,
name: 'Default Organization',
name: process.env.DEFAULT_ORGANIZATION_NAME || 'Default Organization',
slug: 'default-org-slug',
billing_email: 'billing@supabase.co',
projects: [
{
id: 1,
ref: 'default',
name: 'Default Project',
name: process.env.DEFAULT_PROJECT_NAME || 'Default Project',
organization_id: 1,
cloud_provider: 'localhost',
status: 'ACTIVE_HEALTHY',
+3 -2
View File
@@ -1,6 +1,7 @@
import apiWrapper from 'lib/api/apiWrapper'
import { NextApiRequest, NextApiResponse } from 'next'
import apiWrapper from 'lib/api/apiWrapper'
export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler)
async function handler(req: NextApiRequest, res: NextApiResponse) {
@@ -20,7 +21,7 @@ const handleGet = async (req: NextApiRequest, res: NextApiResponse) => {
const response = {
id: 1,
ref: 'default',
name: 'Default Project',
name: process.env.DEFAULT_PROJECT_NAME || 'Default Project',
organization_id: 1,
cloud_provider: 'localhost',
status: 'ACTIVE_HEALTHY',
+3 -2
View File
@@ -1,6 +1,7 @@
import apiWrapper from 'lib/api/apiWrapper'
import { NextApiRequest, NextApiResponse } from 'next'
import apiWrapper from 'lib/api/apiWrapper'
export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler)
async function handler(req: NextApiRequest, res: NextApiResponse) {
@@ -21,7 +22,7 @@ const handleGetAll = async (req: NextApiRequest, res: NextApiResponse) => {
{
id: 1,
ref: 'default',
name: 'Default Project',
name: process.env.DEFAULT_PROJECT_NAME || 'Default Project',
organization_id: 1,
cloud_provider: 'localhost',
status: 'ACTIVE_HEALTHY',
+2 -1
View File
@@ -1,4 +1,5 @@
import { NextApiRequest, NextApiResponse } from 'next'
import apiWrapper from 'lib/api/apiWrapper'
export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler)
@@ -27,7 +28,7 @@ const handleGetAll = async (req: NextApiRequest, res: NextApiResponse) => {
db_user: 'postgres',
id: 1,
inserted_at: undefined,
name: 'Default Project',
name: process.env.DEFAULT_PROJECT_NAME || 'Default Project',
ref: 'default',
status: 'ACTIVE_HEALTHY',
services: [
@@ -1,4 +1,5 @@
import { NextApiRequest, NextApiResponse } from 'next'
import apiWrapper from 'lib/api/apiWrapper'
export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler)
@@ -21,7 +22,7 @@ const handleGetAll = async (req: NextApiRequest, res: NextApiResponse) => {
project: {
id: 1,
ref: 'default',
name: 'Default Project',
name: process.env.DEFAULT_PROJECT_NAME || 'Default Project',
status: 'ACTIVE_HEALTHY',
organization_id: 1,
inserted_at: '2021-08-02T06:40:40.646362',
@@ -1,4 +1,5 @@
import { NextApiRequest, NextApiResponse } from 'next'
import apiWrapper from 'lib/api/apiWrapper'
export default (req: NextApiRequest, res: NextApiResponse) => apiWrapper(req, res, handler)
@@ -29,7 +30,7 @@ const handleGetAll = async (req: NextApiRequest, res: NextApiResponse) => {
id: 1,
inserted_at: undefined,
jwt_secret: '-',
name: 'Default Project',
name: process.env.DEFAULT_PROJECT_NAME || 'Default Project',
ref: 'default',
region: 'ap-southeast-1',
status: 'ACTIVE_HEALTHY',