Skip to content

Add Info on the config page #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 8, 2023
Merged

Add Info on the config page #46

merged 2 commits into from
Mar 8, 2023

Conversation

lucasscw
Copy link
Contributor

@lucasscw lucasscw commented Mar 2, 2023

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Relates OR Closes #0000

Release note :

 - Edit Configuration page documentation

@lucasscw lucasscw requested a review from cyclimse March 2, 2023 11:16
When deploying, the `scw-serverless` CLI will look for a Serverless instance in the global scope.

.. code-block:: python

import os
from scw_serverless import Serverless

app = Serverless("my-namespace", secret={
"SCW_SECRET_KEY": os.environ["SCW_SECRET_KEY"]
app = Serverless(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure about the formatting


.. autoclass:: scw_serverless.config.function.FunctionKwargs

.. code-block:: python
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should it be directly in the FunctionKwargs documentation ?

"SCW_SECRET_KEY": os.environ["SCW_SECRET_KEY"],
"MY_SECRET_KEY": os.environ["MY_SECRET_KEY"]
},
gateway_domains=["app.example.com"]
})

.. autoclass:: scw_serverless.app.Serverless
Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • I don't know how we could Highlight that the func() method creates the endpoints
  • get() along with the other method should be described in a full section with details on the API gateway config

Copy link
Contributor

Choose a reason for hiding this comment

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

That's a really brilliant idea, it makes sense to group everything API-gateway related into a single big config chapter. Thanks a lot for the suggestion.

def handler(event, context):
# Do Things
return {"message": "Hello World"}

Triggers
--------

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On Cron trigger:

  • Is the function private by default ?
  • What is the difference between cron and the schedule() Method in the App object ?
  • Add an example

Copy link
Contributor

Choose a reason for hiding this comment

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

  • No, I think it will be made public currently if you don't specify. That doesn't make a lot of sense indeed for crons. I will change it so that @app.schedule() returns sets the privacy to private if not specified.
  • The CronTrigger class can be passed to the @app.schedule() instead of a string. The only benefit of that is to pass a name in addition to the cron schedule.

I don't know why the CronTrigger section only talks about this class because ultimately we want people to use @app.schedule("0 1 * * * *") to make their crons and not @app.func(triggers=[CronTrigger(schedule="0 1 * * * *")], name="toto") I will update the docs to reflect this.

I really the idea of adding the examples directly into the docs as you did, it's really nice 💯

@cyclimse cyclimse merged commit 2a9aca9 into main Mar 8, 2023
@cyclimse cyclimse deleted the lucasscw-patch-doc branch March 8, 2023 17:07
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