question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Allow non-default configuration location

See original GitHub issue

I’d like to have the ability to pass my API configuration rather than putting it in [app-root]/data/strava_config or env properties.

Ideally I would like to be able to pass a configuration object to the API. That would allow me to parse the configuration however I want and not have to add to my ever growing list of env props. If this is something that seems reasonable I can spend some time to create / submit a PR?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:4
  • Comments:5

github_iconTop GitHub Comments

2reactions
HyperSpritecommented, Dec 17, 2016

I ran into this today, my dir structure has node_modules two levels up from my server.js. I also already had a config file that was imported into my server.js file for such things. What I ended up doing was adding the following in my server.js file which still allows the options on the command line (it’s a bit ugly but it works fine):

process.env.STRAVA_ACCESS_TOKEN = process.env.STRAVA_ACCESS_TOKEN || undefined;
process.env.STRAVA_CLIENT_ID = process.env.STRAVA_CLIENT_ID || config.stravaLogin.clientID;
process.env.STRAVA_CLIENT_SECRET = process.env.STRAVA_CLIENT_SECRET || config.stravaLogin.clientSecret;
process.env.STRAVA_REDIRECT_URI = process.env.STRAVA_REDIRECT_URI || config.stravaLogin.redirectURI;

For example, my config.js file looks like this:

module.exports = {
  stravaLogin: {
    clientID: 'YOUR_STRAVA_CLIENT_ID',
    clientSecret: 'YOUR_STRAVA_CLIENT_SECRET',
    redirectURI: 'auth/strava',
  },
};

Note: I also found if I did not pass undefined to process.env.STRAVA_ACCESS_TOKEN, it would complain about needing an access token.

Figured this might help the next person. Cheers

2reactions
UnbounDevcommented, Jun 6, 2016

The location is relative to your projects root directory (the modules data/ dir is provided for reference), but I agree this ought to be configurable according to the developers wishes.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Non-default location for ssh config file in Linux
Specifies an alternative per-user configuration file. If a configuration file is given on the command line, the system-wide configuration file ...
Read more >
Configuration of the My Documents folder
By default, the My Documents folder is a folder in the user's profile that is used as a default storage location for saved...
Read more >
Git - git-config Documentation
Opens an editor to modify the specified config file; either --system , --global , or repository (default). --[no-]includes. Respect include.* directives in ...
Read more >
User and Workspace Settings - Visual Studio Code
Settings file locations​​ Depending on your platform, the user settings file is located here: Windows %APPDATA%\Code\User\settings.json. macOS $HOME/Library/ ...
Read more >
Configuration — yamllint 1.28.0 documentation - Read the Docs
Finally if no config file is found, the default configuration is applied. Default configuration¶. Unless told otherwise, yamllint uses its default configuration ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found