Options
You can configure various options to streamline your workflow with GitRows.
options(object params)
You can use the options()
method to set or get the options of the GitRows instance. The available options and their default values are:
{
server: undefined,
ns: 'github',
owner: undefined,
repo: undefined,
branch: 'master',
path: undefined,
user: undefined,
token: undefined,
message: 'GitRows API Post (https://gitrows.com)',
author: { name: 'GitRows', email: 'api@gitrows.com' },
csv: { delimiter: ',' },
type: undefined,
columns: undefined,
strict: false,
default: null
}
Repo related options
The following options are data file repository related and may be overwritten by GitRows while parsing an url or API call:
server
used in connection withns:'gitlab'
: You can use GitLab installations on other webservers than gitlab by providing its url, e.g.gitlab.example.com
ns
eithergithub
orgitlab
owner
repository ownerrepo
repository namebranch
select another thanmaster
path
directory and/or file name with extension
If you want to alter the contents of the data files you need to provide a username and access token for the selected namespace:
user
a GitHub or GitLab username (may be omitted for GitLab)token
a GitHub or GitLab token
The commits are done with a standard message and authored by GitRows by default. Change if needed. This is useful for different GitRows instances committing to the same repo:
message
commit messageauthor
an object with the propertiesname
andemail
to identify the committer
Data format related options
You can set these output options:
csv
the option accepts only an object with the propertydelimiter
, others might be added in future versionstype
eitherjson
orcsv
- in most cases there is no need to set this as GitRows determines the type by the data file extension and by parsing its content, but might be useful for debugging purposescolumns
either determined by the data file entries or set as anArray
with the column names - only applied ifstrict
istrue
strict
if set totrue
GitRows will enforce the column scheme found in the data file or set by the columns option for all added data entriesdefault
the default value used in strict mode for amending entries with missing column data