write_scrapebot_credentials: Write ScrapeBot database credentials to INI file

Description Usage Arguments Details Value See Also Examples

View source: R/write_credentials.R

Description

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.

Usage

1
2
3
4
5
6
7
write_scrapebot_credentials(
  host,
  user = NULL,
  password = NULL,
  database = "scrapebot",
  port = 0
)

Arguments

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 scrapebot.

port

The port number to connect to (only used if greater than 0; not needed for MySQL if 3306). Defaults to 0.

Details

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:

Value

The file name of the newly created credentials file, if successful.

See Also

connect_scrapebot() to use the credential file in practice

Examples

1
2
write_scrapebot_credentials('localhost', 'root', 'my_password')
write_scrapebot_credentials(':memory:')

MarHai/ScrapeBotR documentation built on March 10, 2021, 10:10 a.m.