From: Ammar Faizi <[email protected]>
To: Muhammad Rizki <[email protected]>,
GNU/Weeb Mailing List <[email protected]>
Cc: Alviro Iskandar Setiawan <[email protected]>
Subject: Re: [PATCH v1 2/2] Allow custom MySQL port from the env file
Date: Sun, 25 Dec 2022 05:59:08 +0700 [thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
On 12/25/22 5:57 AM, Muhammad Rizki wrote:
> This code can be shorten to:
> client = GWClient(
> db_conn=connector.connect(
> host=os.getenv("DB_HOST"),
> user=os.getenv("DB_USER"),
> port=int(os.environ.get("DB_PORT", 3306)),
> password=os.getenv("DB_PASS"),
> database=os.getenv("DB_NAME")
> )
>
> `os.environ` here is a dict object, a dict object has a .get() function,
> the second argument of the .get() is a default return if the first argument (dict key) is not exist. Like, DB_PORT is not exist in dict keys, then it will return 3306.
LGTM, but I already applied my patches.
Please do that in your patch series later.
--
Ammar Faizi
prev parent reply other threads:[~2022-12-24 22:59 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-24 22:00 [PATCH v1 0/2] A bug fix and allow custom MySQL port Ammar Faizi
2022-12-24 22:00 ` [PATCH v1 1/2] telegram: listener: Fix missing MySQL error recovery function Ammar Faizi
2022-12-24 22:59 ` Muhammad Rizki
2022-12-24 22:00 ` [PATCH v1 2/2] Allow custom MySQL port from the env file Ammar Faizi
2022-12-24 22:57 ` Muhammad Rizki
2022-12-24 22:59 ` Ammar Faizi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox