Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

YAML not working #44

Closed
radleymith opened this issue Mar 21, 2016 · 7 comments
Closed

YAML not working #44

radleymith opened this issue Mar 21, 2016 · 7 comments
Assignees

Comments

@radleymith
Copy link

The loader strategy for LoadFileConfigStrategy.js is not working correctly. It basically isn't picking up my stormpath.yml file in the main folder for my app. This seems to be because it isn't looking in the correct filepath for the stormpath.yml. There are 2ish main reasons/files associated for this(I think):

  1. File - ConfigLoader.js
    Function - ConfigLoader.prototype.load
    Line - 73) tasks.push(strategies[i].process.bind(strategies[i]));
  2. File - LoadFileConfigStrategy.js
    Function - LoadFileConfigStrategy.prototype.process
    Line - 24) var filePath = expandHomeDir(this.filePath);
    The base problem is that the filepath is not being expanded correctly(though i think expandHomeDir is doing what you want). I can't tell if this is because the state has been bound in an incorrect way or if the LoadFileConfigStrategy needs to do something different. There also seems to be some inconsistencies in the way things are used: for instance why check fs.exists(this.filePath) and then read from fs.readFile(filePath).

I also realize that this could all be correct and it's some async error i haven't accounted for.

@typerandom typerandom self-assigned this Mar 29, 2016
@typerandom
Copy link
Contributor

Hi Radley,

Thanks for reporting this.

I have looked into it and I don't see any issue with the first thing that you mentioned. Binding there seems fine. But the second one was clearly wrong and the expanded home directory wasn't even used. So even though we expanded it, we were still used the original path.

I have fixed this and will soon create a PR for review/release.

A quick question, what OS are you using?

@radleymith
Copy link
Author

Im using OSX El Capitan 10.11.2

I also pulled down the new file and tried using it. I'm still getting an error that API key ID and secret is required. I have put some logs in checking the state of the original file path and the expanded file path. Here are their results:

original: ~/.stormpath/stormpath.json
expanded: /Users/MY_USERNAME/.stormpath/stormpath.json
original: ~/.stormpath/stormpath.yml
expanded: /Users/MY_USERNAME/.stormpath/stormpath.yml
original: /Users/MY_USERNAME/workspace/MY_APP/stormpath.json
expanded: /Users/MY_USERNAME/workspace/MY_APP/stormpath.json
original: /Users/MY_USERNAME/workspace/MY_APP/stormpath.yml 
expanded: /Users/MY_USERNAME/workspace/MY_APP/stormpath.yml

currently my YAML file resides here /Users/MY_USERNAME/workspace/MY_APP/stormpath.yml. (which would show that the final instance of the expandedDir being correct.)

Could multiple trips through the process be affecting the result?
I get that it's going through the various steps in checking where the file could be located, I'm just wondering.

side note: I've tried saving it as both .yaml and .yml file, neither are working

@radleymith
Copy link
Author

I am noticing that the strategies are called with a config parameter, but this seems to be just a default object. Like when ValidateClientConfigStrategy is called, it has a fleshed out object, but the values like client.apiKey are null

@radleymith
Copy link
Author

Nvm, it works thanks!

@typerandom
Copy link
Contributor

Did you get it to work? Was it because of permissions to the file?

@radleymith
Copy link
Author

It's working. I wrote the yaml without spaces between the colon and the value so it was getting parsed incorrectly. Really sorry about this. :\

@typerandom
Copy link
Contributor

No problem! Good to hear that you solved it! :) Closing this issue now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants