From b40d441c52f37584653e74fada9906cc8105c9f7 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 6 Oct 2016 13:54:52 -0400 Subject: 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. --- HTTP/Client.hs | 6 +++++- HTTP/Server.hs | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'HTTP') 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) -- cgit v1.2.3