Created
June 20, 2017 14:03
-
-
Save philippeback/267f95b1e5716339f9fc22824b438111 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|application secureApp removeHandlers secureTools handlersToKeep filesHandlerName toolHandlerNames keepDevTools | | |
secureApp := true. | |
removeHandlers := true. | |
secureTools := true. | |
keepDevTools := false. | |
Author fullName: 'PhilippeBack'. | |
" =========== Patches start ======== " | |
#( | |
'Somefileout.st' | |
) do: [ :patch | | |
Transcript show: ' Patching with: ', patch; cr. | |
(FileLocator imageDirectory / 'patches' / patch) readStreamDo: [ :s | s fileIn ]. | |
Transcript show: ' Patched.', patch; cr. | |
]. | |
" =========== Patches end ======== " | |
filesHandlerName := 'files'. | |
toolHandlerNames := { 'tools'. 'status'. 'browse' } asOrderedCollection. | |
handlersToKeep := toolHandlerNames copy add: filesHandlerName; yourself. | |
"Set Jira Account" | |
JiraSettings | |
jiraUrl: '<something>.atlassian.net'; | |
jiraUsername: '<someuser>'; | |
jiraPassword: '<somepassord>'. | |
"Remove all handlers not for keeps" | |
(WADispatcher default handlers keys difference: handlersToKeep) | |
do:[ :name | WAAdmin unregister:name ]. | |
"Dev tools or not" | |
keepDevTools ifFalse: [ | |
WAAdmin applicationDefaults | |
removeParent: WADevelopmentConfiguration instance ]. | |
" | |
Register application handler | |
and start the server on port 8082, | |
including serving static files | |
" | |
HOWebApplication declareApplicationAndStartServer. | |
"Secure app handler if needed" | |
secureApp ifTrue: [ | |
application := WADispatcher default handlerAt: 'smartweb'. | |
application configuration addParent: WAAuthConfiguration instance. | |
application | |
preferenceAt: #login put: '<someweblogin>'; | |
preferenceAt: #passwordHash put: (GRPlatform current secureHashFor: '<somewebpassword>'). | |
application | |
addFilter: WAAuthenticationFilter new ]. | |
"Secure other apps if needed - no need to secure files" | |
secureTools ifTrue: [ | |
toolHandlerNames do: [ :toolHandlerName | | |
application := WADispatcher default handlerAt: toolHandlerName. | |
application configuration addParent: WAAuthConfiguration instance. | |
application | |
preferenceAt: #login put: 'admin'; | |
preferenceAt: #passwordHash put: (GRPlatform current secureHashFor: '<someadminpassword>'). | |
application | |
addFilter: WAAuthenticationFilter new | |
] | |
]. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With the declareApplicationAndStartServer doing something like:
and