Skip to content

Instantly share code, notes, and snippets.

@kstseng
Last active March 5, 2019 17:29

Revisions

  1. kstseng revised this gist Mar 5, 2019. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions load_credential.R
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,7 @@
    ##
    ## R sample code for loading credential
    ##

    library(configr)
    config = read.config(file = '~/.config/credential')

  2. kstseng revised this gist Mar 5, 2019. 1 changed file with 17 additions and 5 deletions.
    22 changes: 17 additions & 5 deletions load_credential.R
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,20 @@
    library(configr)
    config = read.config(file = '/Users/kaishentseng/.config/company/credential')
    config = read.config(file = '~/.config/credential')

    print(sprintf('username_a: %s', config$section_a$username))
    print(sprintf('password_a: %s', config$section_a$password))
    print(sprintf('username_b: %s', config$section_b$username))
    print(sprintf('password_b: %s', config$section_b$password))
    ## section_a
    username_a = config$section_a$username
    password_a = config$section_a$password

    ## section_b
    username_b = config$section_b$username
    password_b = config$section_b$password

    print(sprintf('username_a: %s', username_a))
    print(sprintf('password_a: %s', password_a))
    print(sprintf('username_b: %s', username_b))
    print(sprintf('password_b: %s', password_b))

    ## username_a: abc
    ## password_a: 123
    ## username_b: def
    ## password_b: 456
  3. kstseng created this gist Mar 5, 2019.
    8 changes: 8 additions & 0 deletions load_credential.R
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    library(configr)
    config = read.config(file = '/Users/kaishentseng/.config/company/credential')

    print(sprintf('username_a: %s', config$section_a$username))
    print(sprintf('password_a: %s', config$section_a$password))
    print(sprintf('username_b: %s', config$section_b$username))
    print(sprintf('password_b: %s', config$section_b$password))