Browse Source

FileServer.st: add -p commandline option

node server/server.js -p 5000

will start the server to listen on port 5000
mkroehnert 12 years ago
parent
commit
9b4ca5d461
1 changed files with 8 additions and 0 deletions
  1. 8 0
      server/FileServer.st

+ 8 - 0
server/FileServer.st

@@ -573,6 +573,14 @@ mimeTypeFor: aString
 !FileServer class methodsFor: 'initialization'!
 
 main
+	| arguments portOption port|
+	arguments := process argv.
+	portOption := arguments at: 3 ifAbsent: [nil].
+	port := arguments at: 4 ifAbsent: [nil].
+
+	('-p' = portOption and: [port notNil]) ifTrue: [
+		FileServer port: port.
+	].
 	^self new startOn: self port
 ! !