Conversation
…amers into ci-cd-app-engine
…amers into ci-cd-app-engine
…amers into ci-cd-app-engine
* Create python-app.yml * formatting * reformatting code * Delete python-app.yml * adding first test * adding first test * requirements * Update ci.yml * Update ci.yml * refactoring env vars * formatting * adding env for test * using env.test * using env.test * adding env.test * Update ci.yml * adding env.test * adding env.test * code coverage
| @@ -0,0 +1,18 @@ | |||
| ENV=dev | |||
| CLIENT_ID=6zakmdaqzkjqga9fmmsq922uq3tgw0 | |||
| CLIENT_SECRET=qsgqic56t5mrip34lz5mcbr9o09ns3 | |||
There was a problem hiding this comment.
remember to refresh all this secrets :)
|
|
||
|
|
||
| AUTH0_DOMAIN = 'zapperson.us.auth0.com' | ||
| AUTH0_DOMAIN = "zapperson.us.auth0.com" |
There was a problem hiding this comment.
its not better to leave it to ".env"
| token = decode_jwt(Authorization) | ||
| nickname = token['https://brstreamers.dev/nickname'] | ||
| if(nickname == user_login): | ||
| nickname = token["https://brstreamers.dev/nickname"] |
There was a problem hiding this comment.
What you think about this approach?
than you can leave the URL on .env or other place than you think could be better :)
URL="https://brstreamers.dev"
nickname = token[f"{URL}/nickname}| allow_origins=origins, | ||
| allow_origins=origins, | ||
| allow_credentials=True, | ||
| allow_methods=["*"], |
There was a problem hiding this comment.
Maybe in future review to not use "*". but alow only what we really want.
| @@ -26,14 +29,16 @@ | |||
|
|
|||
| @app_public.get("/streams", response_model=List[StreamViewModel]) | |||
| @cache(expire=60) | |||
There was a problem hiding this comment.
Create a variable EXPIRE_TIME = 60
and use in all
@cache(expire=EXPIRE_TIME)|
|
||
|
|
||
| @app_public.get("/vods", response_model=List[VodViewModel]) | ||
| @cache(expire=60) |
| if os.environ["ENV"] == "prod": | ||
| uvicorn.run( | ||
| "main:app", | ||
| host="0.0.0.0", |
There was a problem hiding this comment.
is this host="0.0.0.0" really necessary?
| res = ( | ||
| User.update( | ||
| { | ||
| User.instagram: user.instagram, |
There was a problem hiding this comment.
future issue: its not better to leave it in one list?
linkedin, github, twitter, discord ...
| config = dotenv_values(".env") | ||
|
|
||
|
|
||
| twitch = Twitch(config['CLIENT_ID'], config['CLIENT_SECRET']) |
|
|
||
| try: | ||
| streamers = get_users_by_name(stream_users) | ||
| for s in streamers: |
There was a problem hiding this comment.
its not better to use:
for streamer in streamers:instead of s?
| vods_model.append(stream) | ||
| try: | ||
| streamers = get_users_by_name(vod_users) | ||
| for s in streamers: |
No description provided.