Advertisement
Guest User

Untitled

a guest
Jun 20th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.13 KB | None | 0 0
  1. |application secureApp removeHandlers secureTools handlersToKeep filesHandlerName toolHandlerNames keepDevTools |
  2.  
  3. secureApp := true.
  4. removeHandlers := true.
  5. secureTools := true.
  6. keepDevTools := false.
  7.  
  8.  
  9. Author fullName: 'PhilippeBack'.
  10.  
  11. " =========== Patches start ======== "
  12. #(
  13. 'Somefileout.st'
  14. ) do: [ :patch |
  15. Transcript show: ' Patching with: ', patch; cr.
  16. (FileLocator imageDirectory / 'patches' / patch) readStreamDo: [ :s | s fileIn ].
  17. Transcript show: ' Patched.', patch; cr.
  18. ].
  19.  
  20. " =========== Patches end ======== "
  21.  
  22. filesHandlerName := 'files'.
  23. toolHandlerNames := { 'tools'. 'status'. 'browse' } asOrderedCollection.
  24.  
  25. handlersToKeep := toolHandlerNames copy add: filesHandlerName; yourself.
  26.  
  27. "Set Jira Account"
  28. JiraSettings
  29. jiraUrl: '<something>.atlassian.net';
  30. jiraUsername: '<someuser>';
  31. jiraPassword: '<somepassord>'.
  32.  
  33. "Remove all handlers not for keeps"
  34. (WADispatcher default handlers keys difference: handlersToKeep)
  35. do:[ :name | WAAdmin unregister:name ].
  36.  
  37. "Dev tools or not"
  38. keepDevTools ifFalse: [
  39. WAAdmin applicationDefaults
  40. removeParent: WADevelopmentConfiguration instance ].
  41.  
  42. "
  43. Register application handler
  44. and start the server on port 8082,
  45. including serving static files
  46. "
  47. HOWebApplication declareApplicationAndStartServer.
  48.  
  49. "Secure app handler if needed"
  50. secureApp ifTrue: [
  51. application := WADispatcher default handlerAt: 'smartweb'.
  52. application configuration addParent: WAAuthConfiguration instance.
  53. application
  54. preferenceAt: #login put: '<someweblogin>';
  55. preferenceAt: #passwordHash put: (GRPlatform current secureHashFor: '<somewebpassword>').
  56. application
  57. addFilter: WAAuthenticationFilter new ].
  58.  
  59. "Secure other apps if needed - no need to secure files"
  60. secureTools ifTrue: [
  61. toolHandlerNames do: [ :toolHandlerName |
  62.  
  63. application := WADispatcher default handlerAt: toolHandlerName.
  64. application configuration addParent: WAAuthConfiguration instance.
  65. application
  66. preferenceAt: #login put: 'admin';
  67. preferenceAt: #passwordHash put: (GRPlatform current secureHashFor: '<someadminpassword>').
  68. application
  69. addFilter: WAAuthenticationFilter new
  70. ]
  71. ].
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement