diff options
author | Joey Hess <joeyh@joeyh.name> | 2016-10-06 13:54:52 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2016-10-06 13:54:52 -0400 |
commit | b40d441c52f37584653e74fada9906cc8105c9f7 (patch) | |
tree | 737396d6ab61212cad52555c7bc99dedd167b330 /HTTP | |
parent | 54d3bfbb98958cb49399f1a7f092fa43593ef4c8 (diff) | |
download | keysafe-b40d441c52f37584653e74fada9906cc8105c9f7.tar.gz |
move level from Server to Storage
This allows local storage locations to have levels too, and also get
shuffled nicely.
This commit was sponsored by Ethan Aubin.
Diffstat (limited to 'HTTP')
-rw-r--r-- | HTTP/Client.hs | 6 | ||||
-rw-r--r-- | HTTP/Server.hs | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/HTTP/Client.hs b/HTTP/Client.hs index 50c5906..8415b2f 100644 --- a/HTTP/Client.hs +++ b/HTTP/Client.hs @@ -9,7 +9,6 @@ import HTTP import HTTP.ProofOfWork import Types import Types.Server -import Servers import Types.Storage import Types.Cost import Servant.API @@ -111,3 +110,8 @@ socketConnection socket chunksize = makeConnection (recv socket chunksize) (sendAll socket) (Network.Socket.close socket) + +serverUrls :: Server -> [BaseUrl] +serverUrls srv = map go (serverAddress srv) + where + go (ServerAddress addr port) = BaseUrl Http addr port "" diff --git a/HTTP/Server.hs b/HTTP/Server.hs index 886fe6f..6fd570d 100644 --- a/HTTP/Server.hs +++ b/HTTP/Server.hs @@ -56,7 +56,7 @@ runServer d cfg = do host = fromString (serverAddress cfg) serverStorage :: Maybe LocalStorageDirectory -> Storage -serverStorage d = localStorage (storageDir d) "server" +serverStorage d = localStorage LocallyPreferred (storageDir d) "server" app :: ServerState -> Application app st = serve userAPI (server st) |