Skip to content

Commit

Permalink
treat fe domain differently
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-hub committed Oct 9, 2024
1 parent 5931da2 commit b060825
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ services:
- DEBUG='1'
- JWT_SECRET=your_jwt_secret_here
- ENABLE_DJANGO_ADMIN='0'
- DOMAIN_NAME='localhost'
- SITE_DOMAIN='localhost'
- FRONTEND_DOMAIN='localhost'
depends_on:
- postgres
- redis
Expand Down
6 changes: 2 additions & 4 deletions promptsmith/.env.default
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,14 @@ POSTGRES_DB='ps'
POSTGRES_USER='postgres'
POSTGRES_PASSWORD=''


ENABLE_DJANGO_ADMIN='False'

DOMAIN_NAME='localhost'
SITE_DOMAIN='localhost'
FRONTEND_DOMAIN='localhost'

SERVER_EMAIL='contact@localhost'
EMAIL_HOST='localhost'
EMAIL_PORT='1025'
EMAIL_HOST_USER='user'
EMAIL_HOST_PASSWORD='password'
EMAIL_USE_TLS='True'


7 changes: 6 additions & 1 deletion promptsmith/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,16 @@
RUNNING_DEVELOPMENT_SERVER = (len(sys.argv) > 1 and sys.argv[1] == 'runserver')
ENABLE_DJANGO_ADMIN = os.getenv('ENABLE_DJANGO_ADMIN', False) == '1'

SITE_DOMAIN = os.getenv('DOMAIN_NAME', 'localhost')
SITE_DOMAIN = os.getenv('SITE_DOMAIN', 'localhost')
FRONTEND_DOMAIN = os.getenv('FRONTEND_DOMAIN', 'localhost')

ALLOWED_HOSTS = [
'localhost',
'127.0.0.1',
'backend',
'frontend',
SITE_DOMAIN,
FRONTEND_DOMAIN,
]

CORS_ALLOWED_ORIGINS = [
Expand All @@ -67,6 +69,9 @@
'http://api.{}'.format(SITE_DOMAIN),
'http://app.{}'.format(SITE_DOMAIN),
'http://www.{}'.format(SITE_DOMAIN),
'https://{}'.format(FRONTEND_DOMAIN),
'https://www.{}'.format(FRONTEND_DOMAIN),
'https://app.{}'.format(FRONTEND_DOMAIN),
]

CORS_ALLOW_CREDENTIALS = True # allow cookies in Lax mode managed in session cookie same site
Expand Down

0 comments on commit b060825

Please sign in to comment.