Description Usage Arguments Details Value See Also Examples
View source: R/write_credentials.R
You should not use connection functionality by regularly publishing credentials in the console. While credentials will end up in the console log, you also risk pushing scripts including credentials to any sustainable repositories (e.g., Git). Instead, you should prepare an INI file which will then be read/used by the connection functionality.
1 2 3 4 5 6 7 | write_scrapebot_credentials(
host,
user = NULL,
password = NULL,
database = "scrapebot",
port = 0
)
|
host |
The central database host to connect to as character string. |
user |
The username to connect to the central database as character string. |
password |
According password as character string. |
database |
Represents the database name as character string. Defaults to |
port |
The port number to connect to (only used if greater than 0; not needed for MySQL if 3306). Defaults to |
This function is a helper function to create this INI file for you.
While creating the INI file like so will still end up pushing your credentials to the console log once,
but it will not require you to do that ever again, thus keeping credentials off your repositories.
The function pushes the credentials into an INI-file section called "database
on host
" (e.g., "scrapebot on localhost").
Alternatively, you can absolutely create this INI file yourself. For this, include a file called .scrapebot.ini
(yes, including the leading dot) in your working directory.
This file then needs a section which is indicated in its own line, looking like [my section]
.
Below this line (and thus, within this section) you can specify the following parameters to connect to your database:
host (for example, host=localhost
)
port (for example, port=3307
)
user (for example, user=my_personal_user
)
password (for example, password=abcd3.45d:cba!
)
database (for example, database=scrapebot
)
The file name of the newly created credentials file, if successful.
connect_scrapebot()
to use the credential file in practice
1 2 | write_scrapebot_credentials('localhost', 'root', 'my_password')
write_scrapebot_credentials(':memory:')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.