Skip to content

Commit 4942bee

Browse files
committed
Merge branch 'main' into pr/237
2 parents 5020353 + 0449382 commit 4942bee

File tree

9 files changed

+261
-27
lines changed

9 files changed

+261
-27
lines changed

.github/workflows/ci.yml

+7
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ jobs:
2929
with:
3030
poetry-version: 1.3.2
3131

32+
- uses: supabase/setup-cli@v1
33+
with:
34+
version: latest
35+
36+
- name: Start Supabase local development setup
37+
run: supabase start --workdir infra -x studio,gotrue,postgrest,inbucket,realtime,edge-runtime,logflare,vector,pgbouncer,pg_prove
38+
3239
- name: Run Tests
3340
run: make run_tests
3441

Makefile

+11
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,21 @@ tests: install tests_only tests_pre_commit
1010
tests_pre_commit:
1111
poetry run pre-commit run --all-files
1212

13+
run_infra:
14+
npx supabase --workdir infra start -x studio,gotrue,postgrest,inbucket,realtime,edge-runtime,logflare,vector,pgbouncer,pg_prove
15+
16+
stop_infra:
17+
npx supabase --workdir infra stop
18+
1319
run_tests: tests
1420

21+
local_tests: run_infra sleep tests
22+
1523
tests_only:
1624
poetry run pytest --cov=./ --cov-report=xml --cov-report=html -vv
1725

1826
build_sync:
1927
poetry run unasync storage3 tests
28+
29+
sleep:
30+
sleep 2

infra/supabase/.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Supabase
2+
.branches
3+
.temp
4+
.env

infra/supabase/config.toml

+171
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
# A string used to distinguish different Supabase projects on the same host. Defaults to the
2+
# working directory name when running `supabase init`.
3+
project_id = "storage-py"
4+
5+
[api]
6+
enabled = true
7+
# Port to use for the API URL.
8+
port = 54321
9+
# Schemas to expose in your API. Tables, views and stored procedures in this schema will get API
10+
# endpoints. `public` is always included.
11+
schemas = ["public", "graphql_public"]
12+
# Extra schemas to add to the search_path of every request. `public` is always included.
13+
extra_search_path = ["public", "extensions"]
14+
# The maximum number of rows returns from a view, table, or stored procedure. Limits payload size
15+
# for accidental or malicious requests.
16+
max_rows = 1000
17+
18+
[db]
19+
# Port to use for the local database URL.
20+
port = 54322
21+
# Port used by db diff command to initialize the shadow database.
22+
shadow_port = 54320
23+
# The database major version to use. This has to be the same as your remote database's. Run `SHOW
24+
# server_version;` on the remote database to check.
25+
major_version = 15
26+
27+
[db.pooler]
28+
enabled = false
29+
# Port to use for the local connection pooler.
30+
port = 54329
31+
# Specifies when a server connection can be reused by other clients.
32+
# Configure one of the supported pooler modes: `transaction`, `session`.
33+
pool_mode = "transaction"
34+
# How many server connections to allow per user/database pair.
35+
default_pool_size = 20
36+
# Maximum number of client connections allowed.
37+
max_client_conn = 100
38+
39+
[realtime]
40+
enabled = false
41+
# Bind realtime via either IPv4 or IPv6. (default: IPv4)
42+
# ip_version = "IPv6"
43+
# The maximum length in bytes of HTTP request headers. (default: 4096)
44+
# max_header_length = 4096
45+
46+
[studio]
47+
enabled = false
48+
# Port to use for Supabase Studio.
49+
port = 54323
50+
# External URL of the API server that frontend connects to.
51+
api_url = "http://127.0.0.1"
52+
# OpenAI API Key to use for Supabase AI in the Supabase Studio.
53+
openai_api_key = "env(OPENAI_API_KEY)"
54+
55+
# Email testing server. Emails sent with the local dev setup are not actually sent - rather, they
56+
# are monitored, and you can view the emails that would have been sent from the web interface.
57+
[inbucket]
58+
enabled = false
59+
# Port to use for the email testing server web interface.
60+
port = 54324
61+
# Uncomment to expose additional ports for testing user applications that send emails.
62+
# smtp_port = 54325
63+
# pop3_port = 54326
64+
65+
[storage]
66+
enabled = true
67+
# The maximum file size allowed (e.g. "5MB", "500KB").
68+
file_size_limit = "50MiB"
69+
70+
[storage.image_transformation]
71+
enabled = true
72+
73+
[auth]
74+
enabled = true
75+
# The base URL of your website. Used as an allow-list for redirects and for constructing URLs used
76+
# in emails.
77+
site_url = "http://127.0.0.1:3000"
78+
# A list of *exact* URLs that auth providers are permitted to redirect to post authentication.
79+
additional_redirect_urls = ["https://127.0.0.1:3000"]
80+
# How long tokens are valid for, in seconds. Defaults to 3600 (1 hour), maximum 604,800 (1 week).
81+
jwt_expiry = 3600
82+
# If disabled, the refresh token will never expire.
83+
enable_refresh_token_rotation = true
84+
# Allows refresh tokens to be reused after expiry, up to the specified interval in seconds.
85+
# Requires enable_refresh_token_rotation = true.
86+
refresh_token_reuse_interval = 10
87+
# Allow/disallow new user signups to your project.
88+
enable_signup = true
89+
# Allow/disallow anonymous sign-ins to your project.
90+
enable_anonymous_sign_ins = false
91+
# Allow/disallow testing manual linking of accounts
92+
enable_manual_linking = false
93+
94+
[auth.email]
95+
# Allow/disallow new user signups via email to your project.
96+
enable_signup = false
97+
# If enabled, a user will be required to confirm any email change on both the old, and new email
98+
# addresses. If disabled, only the new email is required to confirm.
99+
double_confirm_changes = false
100+
# If enabled, users need to confirm their email address before signing in.
101+
enable_confirmations = false
102+
# Controls the minimum amount of time that must pass before sending another signup confirmation or password reset email.
103+
max_frequency = "1s"
104+
105+
# Uncomment to customize email template
106+
# [auth.email.template.invite]
107+
# subject = "You have been invited"
108+
# content_path = "./supabase/templates/invite.html"
109+
110+
[auth.sms]
111+
# Allow/disallow new user signups via SMS to your project.
112+
enable_signup = false
113+
# If enabled, users need to confirm their phone number before signing in.
114+
enable_confirmations = false
115+
# Template for sending OTP to users
116+
template = "Your code is {{ .Code }} ."
117+
# Controls the minimum amount of time that must pass before sending another sms otp.
118+
max_frequency = "5s"
119+
120+
# Use pre-defined map of phone number to OTP for testing.
121+
# [auth.sms.test_otp]
122+
# 4152127777 = "123456"
123+
124+
# This hook runs before a token is issued and allows you to add additional claims based on the authentication method used.
125+
# [auth.hook.custom_access_token]
126+
# enabled = true
127+
# uri = "pg-functions://<database>/<schema>/<hook_name>"
128+
129+
# Configure one of the supported SMS providers: `twilio`, `twilio_verify`, `messagebird`, `textlocal`, `vonage`.
130+
[auth.sms.twilio]
131+
enabled = false
132+
account_sid = ""
133+
message_service_sid = ""
134+
# DO NOT commit your Twilio auth token to git. Use environment variable substitution instead:
135+
auth_token = "env(SUPABASE_AUTH_SMS_TWILIO_AUTH_TOKEN)"
136+
137+
# Use an external OAuth provider. The full list of providers are: `apple`, `azure`, `bitbucket`,
138+
# `discord`, `facebook`, `github`, `gitlab`, `google`, `keycloak`, `linkedin_oidc`, `notion`, `twitch`,
139+
# `twitter`, `slack`, `spotify`, `workos`, `zoom`.
140+
[auth.external.apple]
141+
enabled = false
142+
client_id = ""
143+
# DO NOT commit your OAuth provider secret to git. Use environment variable substitution instead:
144+
secret = "env(SUPABASE_AUTH_EXTERNAL_APPLE_SECRET)"
145+
# Overrides the default auth redirectUrl.
146+
redirect_uri = ""
147+
# Overrides the default auth provider URL. Used to support self-hosted gitlab, single-tenant Azure,
148+
# or any other third-party OIDC providers.
149+
url = ""
150+
# If enabled, the nonce check will be skipped. Required for local sign in with Google auth.
151+
skip_nonce_check = false
152+
153+
[analytics]
154+
enabled = false
155+
port = 54327
156+
vector_port = 54328
157+
# Configure one of the supported backends: `postgres`, `bigquery`.
158+
backend = "postgres"
159+
160+
# Experimental features may be deprecated any time
161+
[experimental]
162+
# Configures Postgres storage engine to use OrioleDB (S3)
163+
orioledb_version = ""
164+
# Configures S3 bucket URL, eg. <bucket_name>.s3-<region>.amazonaws.com
165+
s3_host = "env(S3_HOST)"
166+
# Configures S3 bucket region, eg. us-east-1
167+
s3_region = "env(S3_REGION)"
168+
# Configures AWS_ACCESS_KEY_ID for S3 bucket
169+
s3_access_key = "env(S3_ACCESS_KEY)"
170+
# Configures AWS_SECRET_ACCESS_KEY for S3 bucket
171+
s3_secret_key = "env(S3_SECRET_KEY)"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
CREATE POLICY "Enable read access for all users" ON "storage"."objects"
2+
AS PERMISSIVE FOR SELECT
3+
TO public
4+
USING (true);
5+
6+
CREATE POLICY "Enable insert for all users" ON "storage"."objects"
7+
AS PERMISSIVE FOR INSERT
8+
TO public
9+
WITH CHECK (true);
10+
11+
CREATE POLICY "Enable update for all users" ON "storage"."objects"
12+
AS PERMISSIVE FOR UPDATE
13+
TO public
14+
USING (true)
15+
WITH CHECK (true);
16+
17+
CREATE POLICY "Enable delete for all users" ON "storage"."objects"
18+
AS PERMISSIVE FOR DELETE
19+
TO public
20+
USING (true);
21+
22+
CREATE POLICY "Enable read access for all users" ON "storage"."buckets"
23+
AS PERMISSIVE FOR SELECT
24+
TO public
25+
USING (true);
26+
27+
CREATE POLICY "Enable insert for all users " ON "storage"."buckets"
28+
AS PERMISSIVE FOR INSERT
29+
TO public
30+
WITH CHECK (true);
31+
32+
CREATE POLICY "Enable update for all users" ON "storage"."buckets"
33+
AS PERMISSIVE FOR UPDATE
34+
TO public
35+
USING (true)
36+
WITH CHECK (true);
37+
38+
CREATE POLICY "Enable delete for all users" ON "storage"."buckets"
39+
AS PERMISSIVE FOR DELETE
40+
TO public
41+
USING (true);

infra/supabase/seed.sql

Whitespace-only changes.

poetry.lock

+24-24
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ python-dateutil = "^2.8.2"
2828

2929
[tool.poetry.dev-dependencies]
3030
python-semantic-release = "^9.4.1"
31-
black = "^24.3.0"
31+
black = "^24.4.2"
3232
isort = "^5.12.0"
3333
pre-commit = "^3.5.0"
3434
pytest = "^8.1.1"

tests/tests.env

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
SUPABASE_TEST_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlhdCI6MTYzNTAwODQ4NywiZXhwIjoxOTUwNTg0NDg3fQ.l8IgkO7TQokGSc9OJoobXIVXsOXkilXl4Ak6SCX5qI8"
2-
SUPABASE_TEST_URL="https://ibrydvrsxoapzgtnhpso.supabase.co/storage/v1"
1+
SUPABASE_TEST_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0"
2+
SUPABASE_TEST_URL="http://localhost:54321/storage/v1"

0 commit comments

Comments
 (0)