Skip to content

Create python-app.yml#27

Open
flaviojmendes wants to merge 29 commits intomainfrom
ci-cd-app-engine
Open

Create python-app.yml#27
flaviojmendes wants to merge 29 commits intomainfrom
ci-cd-app-engine

Conversation

@flaviojmendes
Copy link
Copy Markdown
Collaborator

No description provided.

@@ -0,0 +1,18 @@
ENV=dev
CLIENT_ID=6zakmdaqzkjqga9fmmsq922uq3tgw0
CLIENT_SECRET=qsgqic56t5mrip34lz5mcbr9o09ns3
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remember to refresh all this secrets :)



AUTH0_DOMAIN = 'zapperson.us.auth0.com'
AUTH0_DOMAIN = "zapperson.us.auth0.com"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"]
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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=["*"],
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same than above

if os.environ["ENV"] == "prod":
uvicorn.run(
"main:app",
host="0.0.0.0",
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this host="0.0.0.0" really necessary?

res = (
User.update(
{
User.instagram: user.instagram,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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'])
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file necessary?


try:
streamers = get_users_by_name(stream_users)
for s in streamers:
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same than line 49.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants