You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Basically I am using JNPM to programatically pull down a npm module so I can use some of its files.
if for some reason the file i'm looking for is deleted I want JNPM to pull it down again when the code executes. So I tried something like this.
if(!script_file.exists()){
JNPMSettings defaultrepo = JNPMSettings.builder()
.homeDirectory(Paths.get(homePath)) //Optional
.downloadDirectory(Paths.get(downloadPath)) //Optional
.installDirectory(Paths.get(installPath))
.username(config.NPMJS_Username()).password(config.NPMJS_Access_Token())
.registryUrl(config.NPMJS_Repo_URL())
.httpLoggerLevel(HttpLoggingInterceptor.Level.BASIC)
.build();
logger.error(String.format("JNPM Configured Password %s", defaultrepo.getPassword()));
if (!JNPMService.isConfigured()){
JNPMService.configure(defaultrepo); // maybe the service should be static? can I do that or something?
}
else if (!JNPMService.instance().getSettings().getPassword().equals(config.NPMJS_Access_Token())){
logger.error(String.format("Old PWD: %s New PWD: %s", JNPMService.instance().getSettings().getPassword(),config.NPMJS_Access_Token()));
JNPMService.configure(defaultrepo);
}
}
I was hoping I could reconfigure the instance with an updated password, but it seems that the service does not allow for a reconfiguration based on what I am seeing.
public static synchronized JNPMService configure(JNPMSettings settings) {
if(isConfigured()) throw new IllegalStateException("You can't configure JNPM twise: it's already initiated");
try {
settings.createAllDirectories();
settings.getLogger().log("Settings: "+settings);
instance = new JNPMService(settings);
return instance;
} catch (Exception e) {
settings.getLogger().log("Can't configure JNPM due to problems with settings", e);
return null;
}
}
So the only way to reconfigure it would be to restart the whole Java program.
The text was updated successfully, but these errors were encountered:
Basically I am using JNPM to programatically pull down a npm module so I can use some of its files.
if for some reason the file i'm looking for is deleted I want JNPM to pull it down again when the code executes. So I tried something like this.
I was hoping I could reconfigure the instance with an updated password, but it seems that the service does not allow for a reconfiguration based on what I am seeing.
So the only way to reconfigure it would be to restart the whole Java program.
The text was updated successfully, but these errors were encountered: