Giter VIP home page Giter VIP logo

cumulus's Issues

standardizing env vars

Need to figure out the best way to deal w/ various authentication related env vars. If we can do this it will probably make the code much simpler.

In our R repos we can easily hard-code the correct vars in our functions, but this package should be more flexible. It gets verbose to have every function with a default

ex_func <- function(..., sas_key = Sys.getenv("DEV_SAS"), endpoint = Sys.getenv("ENDPOINT_URL_TEMPLATE"){
}
#> etc. etc. need to deal w/ dev keys, prod keys, and other container specific keys

I kind of wonder if it could make sense to do something like the {blastula} package does?

From blastula code:

creds_envvar(
  user = Sys.getenv("USER"),
  pass_envvar = "PW",
  host = Sys.getenv("HOST"),
  port = Sys.getenv("PORT")
)

wonder if we could have something like :

initialize <- function(
  SAS_PROD = "SAS_PROD_KEY",
  SAS_DEV = "SAS_DEV_KEY",
  ENDPOINT_URL = "ENDPOINT_URL"
){

#  probably something smarter than this, but just having a list 
#  would allow us to to always refer to env var names standard names
list(
  SAS_PROD = "SAS_PROD_KEY",
  SAS_DEV = "SAS_DEV_KEY",
  ENDPOINT_URL = "ENDPOINT_URL"
)
}

Or could take it further by setting the env variables with Sys.setenv() however it sort of seems like bad practice to have functions setting/possible writing global env vars, but i wonder if there is something similar/better.

initialize <- function(
  CUMULUS_SAS_PROD = "SAS_PROD_KEY",
  CUMULUS_SAS_DEV = "SAS_DEV_KEY",
  CUMULUS_ENDPOINT_URL = "ENDPOINT_URL"
){

#  probably something smarter than this, but just having a list 
#  would allow us to to always refer to env var names standard names
Sys.setenv(
  CUMULUS_SAS_PROD = "SAS_PROD_KEY",
  CUMULUS_SAS_DEV = "SAS_DEV_KEY",
  CUMULUS_ENDPOINT_URL = "ENDPOINT_URL"
)
}

If there was some good way to do it we make the codebase of package simpler as we could basically hard code functions more easily

prod <- prod_blob(CUMULUS_SAS_PROD)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.