Merge pull request 'VORKOUT-2' (#1) from VORKOUT-2 into master
Reviewed-on: #1
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -14,6 +14,7 @@ __pycache__/
 | 
			
		||||
*.log
 | 
			
		||||
*.tmp
 | 
			
		||||
*.bak
 | 
			
		||||
*.pid
 | 
			
		||||
npm-debug.log*
 | 
			
		||||
yarn-debug.log*
 | 
			
		||||
yarn-error.log*
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,9 @@
 | 
			
		||||
from .default import DefaultSettings
 | 
			
		||||
from .prod import ProdSettings
 | 
			
		||||
from .utils import get_settings
 | 
			
		||||
 | 
			
		||||
__all__ = [
 | 
			
		||||
    "DefaultSettings",
 | 
			
		||||
    "ProdSettings",
 | 
			
		||||
    "get_settings",
 | 
			
		||||
]
 | 
			
		||||
 
 | 
			
		||||
@@ -38,6 +38,11 @@ class DefaultSettings(BaseSettings):
 | 
			
		||||
    BROKER_PASSWORD: str = environ.get("BROKER_PASSWORD", "guest")
 | 
			
		||||
    BROKER_RABBITMQ_VHOST: str = environ.get("BROKER_RABBITMQ_VHOST", "")
 | 
			
		||||
 | 
			
		||||
    REDIS_HOST: str = environ.get("REDIS_HOST", "localhost")
 | 
			
		||||
    REDIS_PORT: int = int(environ.get("REDIS_PORT", "6379"))
 | 
			
		||||
    REDIS_DB: int = int(environ.get("REDIS_DB", "0"))
 | 
			
		||||
    REDIS_PASSWORD: str = environ.get("REDIS_PASSWORD", "hackme")
 | 
			
		||||
 | 
			
		||||
    class Config:
 | 
			
		||||
        # env_file = "../.env"
 | 
			
		||||
        env_file_encoding = "utf-8"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								api/api/config/prod.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								api/api/config/prod.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
from api.config.default import DefaultSettings
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class ProdSettings(DefaultSettings): ...
 | 
			
		||||
@@ -1,13 +1,14 @@
 | 
			
		||||
from os import environ
 | 
			
		||||
 | 
			
		||||
from api.config.default import DefaultSettings
 | 
			
		||||
from api.config.prod import ProdSettings
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def get_settings() -> DefaultSettings:
 | 
			
		||||
    env = environ.get("ENV", "local")
 | 
			
		||||
    env_settings = {
 | 
			
		||||
        "local": DefaultSettings,
 | 
			
		||||
        "prod": None,
 | 
			
		||||
        "prod": ProdSettings,
 | 
			
		||||
    }
 | 
			
		||||
    try:
 | 
			
		||||
        return env_settings[env]()
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
[project]
 | 
			
		||||
name = "api"
 | 
			
		||||
version = "0.1.0"
 | 
			
		||||
version = "0.0.1"
 | 
			
		||||
description = ""
 | 
			
		||||
authors = [
 | 
			
		||||
    {name = "Vladislav",email = "vlad.dev@heado.ru"}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										5
									
								
								client/.env.local
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								client/.env.local
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
REACT_APP_WEBSOCKET_PROTOCOL=ws  
 | 
			
		||||
REACT_APP_HTTP_PROTOCOL=http  
 | 
			
		||||
REACT_APP_API_URL=localhost:8000  
 | 
			
		||||
REACT_APP_URL=localhost:3000
 | 
			
		||||
BROWSER=none
 | 
			
		||||
							
								
								
									
										23
									
								
								client/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										23
									
								
								client/.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -1,23 +0,0 @@
 | 
			
		||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
 | 
			
		||||
 | 
			
		||||
# dependencies
 | 
			
		||||
/node_modules
 | 
			
		||||
/.pnp
 | 
			
		||||
.pnp.js
 | 
			
		||||
 | 
			
		||||
# testing
 | 
			
		||||
/coverage
 | 
			
		||||
 | 
			
		||||
# production
 | 
			
		||||
/build
 | 
			
		||||
 | 
			
		||||
# misc
 | 
			
		||||
.DS_Store
 | 
			
		||||
.env.local
 | 
			
		||||
.env.development.local
 | 
			
		||||
.env.test.local
 | 
			
		||||
.env.production.local
 | 
			
		||||
 | 
			
		||||
npm-debug.log*
 | 
			
		||||
yarn-debug.log*
 | 
			
		||||
yarn-error.log*
 | 
			
		||||
@@ -1,6 +1,6 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "client",
 | 
			
		||||
  "version": "0.1.0",
 | 
			
		||||
  "version": "0.0.1",
 | 
			
		||||
  "private": true,
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "@testing-library/dom": "^10.4.0",
 | 
			
		||||
 
 | 
			
		||||
@@ -16,8 +16,19 @@ services:
 | 
			
		||||
      MYSQL_USER: connect
 | 
			
		||||
      MYSQL_PASSWORD: hackme
 | 
			
		||||
    volumes:
 | 
			
		||||
      - data:/var/lib/mysql
 | 
			
		||||
      - mysql_data:/var/lib/mysql
 | 
			
		||||
    ports:
 | 
			
		||||
      - "3306:3306"
 | 
			
		||||
  redis:
 | 
			
		||||
    image: redis:7-alpine
 | 
			
		||||
    container_name: redis
 | 
			
		||||
    command: redis-server --requirepass password
 | 
			
		||||
    environment:
 | 
			
		||||
      REDIS_PASSWORD: hackme
 | 
			
		||||
    ports:
 | 
			
		||||
      - "6379:6379"
 | 
			
		||||
    volumes:
 | 
			
		||||
      - redis_data:/data
 | 
			
		||||
volumes:
 | 
			
		||||
  data:
 | 
			
		||||
  mysql_data:
 | 
			
		||||
  redis_data:
 | 
			
		||||
@@ -10,13 +10,17 @@ environment=
 | 
			
		||||
    MYSQL_HOST=localhost,
 | 
			
		||||
    MYSQL_USER=connect,
 | 
			
		||||
    MYSQL_PORT=3306,
 | 
			
		||||
    MYSQL_PASSWORD=%(ENV_MYSQL_PASSWORD)s,
 | 
			
		||||
    MYSQL_PASSWORD=hackme,
 | 
			
		||||
    BROKER_PROTOCOL=amqp,
 | 
			
		||||
    BROKER_HOST=localhost,
 | 
			
		||||
    BROKER_USER=guest,
 | 
			
		||||
    BROKER_PORT=5672,
 | 
			
		||||
    BROKER_PASSWORD=guest,
 | 
			
		||||
    BROKER_RABBITMQ_VHOST=/
 | 
			
		||||
    BROKER_RABBITMQ_VHOST=/,
 | 
			
		||||
    REDIS_HOST=localhsot,
 | 
			
		||||
    REDIS_PORT=6379,
 | 
			
		||||
    REDIS_PASSWORD=hackme,
 | 
			
		||||
    REDIS_DB=0
 | 
			
		||||
command=bash -c 'cd api; poetry run python3 -m api'
 | 
			
		||||
numprocs=1
 | 
			
		||||
process_name=uvicorn-%(process_num)d
 | 
			
		||||
@@ -25,3 +29,19 @@ stderr_logfile=api.err.log
 | 
			
		||||
autostart=true
 | 
			
		||||
autorestart=true
 | 
			
		||||
startretries=5
 | 
			
		||||
 | 
			
		||||
[program:client]
 | 
			
		||||
environment=
 | 
			
		||||
    REACT_APP_WEBSOCKET_PROTOCOL=ws,
 | 
			
		||||
    REACT_APP_HTTP_PROTOCOL=http,
 | 
			
		||||
    REACT_APP_API_URL=localhost:8000,
 | 
			
		||||
    REACT_APP_URL=localhost:3000
 | 
			
		||||
command=bash -c 'cd client; npm run build; serve -s build'
 | 
			
		||||
numprocs=1
 | 
			
		||||
process_name=node-%(process_num)d
 | 
			
		||||
stdout_logfile=client.out.log
 | 
			
		||||
stderr_logfile=client.err.log
 | 
			
		||||
autostart=true
 | 
			
		||||
autorestart=true
 | 
			
		||||
startretries=5
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user