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

Feature/add sync method to get key #28

Open
wants to merge 2 commits into
base: v1.x/master
Choose a base branch
from

Conversation

janiago
Copy link
Contributor

@janiago janiago commented Nov 15, 2018

In my local project which includes Zowe, I need a function like getKeyFromPassword(), but I need it return a result instead of running a callback.
So I added a new function which works in sync way

@@ -326,6 +326,10 @@ Plugin.prototype = {
else {
throw new Error (`No file name for data service`)
}
// Make the relative path clear. process.cwd() is zlux-example-server/bin/
if (!path.isAbsolute(fileLocation)) {
Copy link
Contributor

@fkovinAtRocket fkovinAtRocket Jan 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please provide some details as to why this is needed? What exactly did you do so that this makes a difference?

@@ -326,6 +326,10 @@ Plugin.prototype = {
else {
throw new Error (`No file name for data service`)
}
// Make the relative path clear. process.cwd() is zlux-example-server/bin/
if (!path.isAbsolute(fileLocation)) {
fileLocation = path.join(process.cwd(),fileLocation);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this even be right? Will a data service ever be found under just process.cwd(), which is, as you're saying, 'zlux-example-server/bin/' ?

@fkovinAtRocket
Copy link
Contributor

fkovinAtRocket commented Jan 8, 2019

@1000TurquoisePogs Sean, this actually raises a good question related to my npm package work.

Let's say I have this plugin "locator": /my-sandbox/zlux-example-server/plugins/com.zowe.explorer.server.auth.json, that says: "pluginLocation": "../../explorer-server-auth/". I'll naturally think that this resolves to /my-sandbox/explorer-server-auth/.

However, actually the file will be /my-sandbox/zlux-example-server/deploy/instance/ZLUX/plugins/com.zowe.explorer.server.auth.json. So, applying the ".." thing, we'll get /my-sandbox/zlux-example-server/deploy/instance/explorer-server-auth, which is wrong.

So a relative pathname there should be relative to what exactly, that is known in the server in runtime?

Also, we're resolving relative pathnames in the config similarly here: https://github.com/zowe/zlux-proxy-server/blob/master/js/index.js#L35 It still looks like a hack: locator authors assume /zlux-example-server/plugins to be the path relative to which everything is, and we use /zlux-example-server/bin instead, and it just happens to work because they all point to ../something anyway

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

Successfully merging this pull request may close these issues.

3 participants