Advertisement
Guest User

Untitled

a guest
Aug 16th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. const config = this._appContext.config
  2. const httpUserName = config.authentication.user
  3. const httpPassword = config.authentication.password
  4. const options = {
  5. auth:{
  6. user: httpUserName ,
  7. pass: httpPassword
  8. }
  9. }
  10.  
  11. return programmedSpotsData.map((item)=>{
  12. let localFile = null
  13. let remoteFile = null
  14. /**
  15. *@todo DRY em logica de remote, local file
  16. */
  17. if(item.file.startsWith(config.localUrl)){
  18. remoteFile = item.file.replace(config.localUrl,config.urls.remoteServerUrl + '/remote/')
  19. remoteFile = remoteFile.replace(/\/id\/[^\/]*/,'')
  20. let dir = config.dirs.spots
  21. if(item.type_sub==='class' || item.type.type_sub==='custom_class'){
  22. dir = config.dirs.class
  23. }
  24. localFile = dir+item.id+config.spotExtension
  25. }
  26. else{//ALready saved
  27. localFile = path.resolve(__dirname,'./webSite/'+item.file)
  28. }
  29. return {
  30. options,
  31. localFile,
  32. remoteFile
  33. }
  34. })
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement