Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

server: added Config machinery #327

Merged
merged 9 commits into from Jan 21, 2016

Conversation

Projects
None yet
4 participants
@soenkehahn
Copy link
Contributor

soenkehahn commented Jan 14, 2016

Replacement for #321 with just one commit.

@jkarni jkarni added the in progress label Jan 14, 2016

@soenkehahn soenkehahn referenced this pull request Jan 14, 2016

Closed

Shahn/config #321

@soenkehahn soenkehahn force-pushed the shahn/config2 branch from afa6978 to e8f9bc0 Jan 14, 2016

(NamedConfig subConfig :: NamedConfig "sub" '[Char])
:. EmptyConfig
subConfig = 'b' :. EmptyConfig
it "allows to extract subconfigs" $ do

This comment has been minimized.

Copy link
@jkarni

jkarni Jan 15, 2016

Member

to extract ==> extracting

This comment has been minimized.

Copy link
@soenkehahn

soenkehahn Jan 15, 2016

Author Contributor

Done.

it "allows to extract subconfigs" $ do
descendIntoNamedConfig (Proxy :: Proxy "sub") config `shouldBe` subConfig

it "allows to extract entries from subconfigs" $ do

This comment has been minimized.

Copy link
@jkarni

jkarni Jan 15, 2016

Member

ditto

This comment has been minimized.

Copy link
@soenkehahn

soenkehahn Jan 15, 2016

Author Contributor

Done.

spec4 = do
with (return namedConfigApp) $ do
describe "WithNamedConfig" $ do
it "allows to descend into a subconfig for a given api" $ do

This comment has been minimized.

Copy link
@jkarni

jkarni Jan 15, 2016

Member

to descend ==> descending

This comment has been minimized.

Copy link
@soenkehahn

soenkehahn Jan 15, 2016

Author Contributor

Done.

{-# LANGUAGE UndecidableInstances #-}

-- | These are custom combinators for S.S.UsingConfigSpec. It's split up into
-- its own module to be able to test how exactly module import work when using

This comment has been minimized.

Copy link
@jkarni

jkarni Jan 15, 2016

Member

works

This comment has been minimized.

Copy link
@soenkehahn

soenkehahn Jan 15, 2016

Author Contributor

Done.


-- | These are custom combinators for S.S.UsingConfigSpec. It's split up into
-- its own module to be able to test how exactly module import work when using
-- the config.

This comment has been minimized.

Copy link
@jkarni

jkarni Jan 15, 2016

Member

I still think this comment isn't very helpful in understanding what part of module import is being tested.

This comment has been minimized.

Copy link
@soenkehahn

soenkehahn Jan 15, 2016

Author Contributor

Is this better: 086e53a ?

@jkarni

This comment has been minimized.

Copy link
Member

jkarni commented Jan 15, 2016

I have purely aesthetic comments - this otherwise LGTM!

@jkarni jkarni referenced this pull request Jan 15, 2016

Open

Support rate limiting #266

@alpmestan

This comment has been minimized.

Copy link
Contributor

alpmestan commented Jan 16, 2016

Great work guys. LGTM.

@soenkehahn soenkehahn force-pushed the shahn/config2 branch from 7e2fb88 to 3c2513c Jan 16, 2016

@soenkehahn

This comment has been minimized.

Copy link
Contributor Author

soenkehahn commented Jan 16, 2016

There are a few things that still needs to be done:

  • documentation,
  • writing instances for WithNamedConfig for all the other interpretations.

Should I already merge this so that others can start to work on auth combinators based on this? Or should I wait till we get these done?

@alpmestan

This comment has been minimized.

Copy link
Contributor

alpmestan commented Jan 16, 2016

Re documentation, I was assuming the tutorial would be augmented with some paragraphs on basic usage of Config along with another bit that explains how to use Config for storing things used by HasServer instances of in-house combinators.

@jkarni

This comment has been minimized.

Copy link
Member

jkarni commented Jan 16, 2016

The policy I thought we were aiming for is that master should always be release-quality, which to me suggests both should be done as part of the PR. I also don't think the tutorial obviates the need for haddocks.

@soenkehahn soenkehahn force-pushed the shahn/config2 branch 2 times, most recently from ddeb8b6 to 8ecc3f0 Jan 16, 2016

@soenkehahn

This comment has been minimized.

Copy link
Contributor Author

soenkehahn commented Jan 16, 2016

@alpmestan: Yeah, the tutorial should include something like that. But that'll be a different repo. (And I don't think we should aim for that being in lockstep with master all the time.)

I just didn't want to block work on the auth combinator. But then I'll say this: 8ecc3f0 is a commit that auth combinators can be based on. I'll refrain from --force pushing another version of that commit. (@jkarni, @aaronlevin)

@aaronlevin

This comment has been minimized.

Copy link
Contributor

aaronlevin commented Jan 16, 2016

@soenkehahn thanks, I'll merge that commit and take it from there!

@soenkehahn soenkehahn force-pushed the shahn/config2 branch from 953ffd8 to c424fae Jan 18, 2016

@@ -295,6 +295,13 @@ instance HasForeign lang sublayout => HasForeign lang (Vault :> sublayout) where
foreignFor lang Proxy req =
foreignFor lang (Proxy :: Proxy sublayout) req

instance HasForeign lang sublayout =>
HasForeign lang (WithNamedConfig name config sublayout) where

This comment has been minimized.

Copy link
@jkarni

jkarni Jan 18, 2016

Member

Doesn't there need to be an instance for (WithNamedConfig name config s) :> sublayout too?

@@ -160,6 +160,9 @@ instance HasMock Raw where

where genBody = pack <$> generate (vector 100 :: Gen [Char])

instance HasMock rest => HasMock (WithNamedConfig name config rest) where

This comment has been minimized.

Copy link
@jkarni

jkarni Jan 18, 2016

Member

Doesn't there need to be an instance for (WithNamedConfig name config s) :> sublayout too?


-- * configs

instance HasServer subApi => HasServer (WithNamedConfig name subConfig subApi) where

This comment has been minimized.

Copy link
@jkarni

jkarni Jan 18, 2016

Member

Doesn't there need to be an instance for (WithNamedConfig name config s) :> sublayout too?

@@ -417,6 +417,12 @@ instance HasClient api => HasClient (IsSecure :> api) where
clientWithRoute Proxy req baseurl manager =
clientWithRoute (Proxy :: Proxy api) req baseurl manager

instance HasClient subapi =>
HasClient (WithNamedConfig name config subapi) where

This comment has been minimized.

Copy link
@jkarni

jkarni Jan 18, 2016

Member

Doesn't there need to be an instance for (WithNamedConfig name config s) :> sublayout too?

This comment has been minimized.

Copy link
@soenkehahn

soenkehahn Jan 20, 2016

Author Contributor

We don't have one like that for HasServer either.

This comment has been minimized.

Copy link
@jkarni

jkarni Jan 20, 2016

Member

Shouldn't there be? I guess it doesn't have to be in this PR, since it's backwards-compatible and we don't want to hold this up.

@@ -794,6 +794,9 @@ instance HasDocs sublayout => HasDocs (Vault :> sublayout) where
docsFor Proxy ep =
docsFor (Proxy :: Proxy sublayout) ep

instance HasDocs sublayout => HasDocs (WithNamedConfig name config sublayout) where

This comment has been minimized.

Copy link
@jkarni

jkarni Jan 18, 2016

Member

Doesn't there need to be an instance for (WithNamedConfig name config s) :> sublayout too?

@fizruk fizruk referenced this pull request Jan 20, 2016

Closed

Middleware combinator #108

@soenkehahn soenkehahn force-pushed the shahn/config2 branch 2 times, most recently from 51bd43a to 731fd0b Jan 20, 2016

-- parentesizing):
--
-- > type UseNamedConfigAPI2 = WithNamedConfig "myConfig" '[String] (
-- > ReqBody '[JSON] Int) :> Get '[JSON] Int

This comment has been minimized.

Copy link
@soenkehahn

soenkehahn Jan 20, 2016

Author Contributor

@jkarni: we don't have an instance for that.

(Could this be doctests?)

@soenkehahn soenkehahn force-pushed the shahn/config2 branch from 63fbd00 to 09b2245 Jan 21, 2016

@soenkehahn soenkehahn merged commit b9fb80a into master Jan 21, 2016

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@jkarni jkarni removed the in progress label Jan 21, 2016

@soenkehahn soenkehahn deleted the shahn/config2 branch Jan 21, 2016

@jkarni jkarni referenced this pull request Jan 21, 2016

Closed

Config #317

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.