这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@tirumaraiselvan
Copy link
Contributor

No description provided.

@hasura-bot
Copy link
Contributor

Review app available at: https://hge-ci-pull-419.herokuapp.com

@tirumaraiselvan tirumaraiselvan changed the title implement custom headers implement custom headers for webhooks Sep 11, 2018
@shahidhk shahidhk added the c/server Related to server label Sep 12, 2018
value <- getHeaderValue header
return $ (,) <$> pure name <*> value

getHeaderName :: HeaderConf -> IO N.HeaderName
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this need not be in IO

data HeaderType = FromEnv | FromValue deriving (Show, Eq, Lift)
$(deriveJSON defaultOptions ''HeaderType)

data HeaderConf
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data HeaderConf = HeaderConf HeaderName HeaderValue
data HeaderValue 
  = HVValue Text
  | HVEnv Text

The json structure can be as follows:

{
  "name" : "Authorization",
  "valueFromEnv": "ET_AUTH_KEY"
}

or

{
  "name" : "X-Source",
  "value": "hasura-et"
}

@hasura-bot
Copy link
Contributor

Review app available at: https://hge-ci-pull-419.herokuapp.com

eventId = eId e
eeCtx <- asks getter

mheaders <- liftIO $ mapM getHeader headerConfs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't read these in every webhook call? We don't expect them to change once the server starts. So you might as well validate them and store the resolved header in the cache.

@hasura-bot
Copy link
Contributor

Review app available at: https://hge-ci-pull-419.herokuapp.com

# Conflicts:
#	server/src-lib/Hasura/Events/Lib.hs
#	server/src-lib/Hasura/RQL/DDL/Subscribe.hs
@tirumaraiselvan tirumaraiselvan changed the title implement custom headers for webhooks custom headers for webhooks and refactor retry logic Sep 14, 2018
@hasura-bot
Copy link
Contributor

Review app available at: https://hge-ci-pull-419.herokuapp.com

@hasura-bot
Copy link
Contributor

Review app available at: https://hge-ci-pull-419.herokuapp.com

…rs_headers

# Conflicts:
#	server/src-lib/Hasura/RQL/DDL/Subscribe.hs
#	server/src-lib/Hasura/RQL/Types/Subscribe.hs
@hasura-bot
Copy link
Contributor

Review app available at: https://hge-ci-pull-419.herokuapp.com

@hasura-bot
Copy link
Contributor

Review app available at: https://hge-ci-pull-419.herokuapp.com

1 similar comment
@hasura-bot
Copy link
Contributor

Review app available at: https://hge-ci-pull-419.herokuapp.com

@hasura-bot
Copy link
Contributor

Review app available at: https://hge-ci-pull-419.herokuapp.com

schemaCachePolicy = SCPReload

getHeadersFromConf :: [HeaderConf] -> IO [(HeaderName, Maybe T.Text)]
getHeadersFromConf = mapM getHeader
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want to throw errors if the environment variable is not present?


curCatalogVer :: T.Text
curCatalogVer = "2"
curCatalogVer = "2.1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change it it 3

phaseTwo q _ = deliverEvent q
schemaCachePolicy = SCPNoChange

getHeadersFromConf :: [HeaderConf] -> IO [(HeaderName, Maybe T.Text)]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's throw an error if the environment variable is not present.

@hasura-bot
Copy link
Contributor

Review app available at: https://hge-ci-pull-419.herokuapp.com

@hasura-bot
Copy link
Contributor

Review app available at: https://hge-ci-pull-419.herokuapp.com

@hasura-bot
Copy link
Contributor

Review app available at: https://hge-ci-pull-419.herokuapp.com

@shahidhk shahidhk changed the title custom headers for webhooks and refactor retry logic add custom headers for webhooks, refactor retry logic Sep 24, 2018
@shahidhk
Copy link
Member

Needs docs

@shahidhk shahidhk added the c/docs Related to docs label Sep 24, 2018
@tirumaraiselvan
Copy link
Contributor Author

tirumaraiselvan commented Sep 24, 2018

Added headers key to the existing API definition. There are two types of headers value and value_from_env

{
"type": "create_event_trigger", 
"args":
    {
    "name": "testtriggerheaders", 
    "table": "users", 
    "update": { "columns" : ["username", "real_name"]},"insert": { "columns" : ["username"]}, 
    "webhook": "https://httpbin.org/post" , 
    "headers":[{
        "name": "X-Hasura-From-Val", 
        "value": "myvalueNEW"
        }, 
        {
        "name": "X-Hasura-From-Env", 
        "value_from_env": "EVENT_WEBHOOK_HEADER"
        }]
    } 
}

@shahidhk shahidhk removed the c/docs Related to docs label Sep 24, 2018
@shahidhk shahidhk merged commit 2cd2b23 into hasura:master Sep 24, 2018
@hasura-bot
Copy link
Contributor

Review app https://hge-ci-pull-419.herokuapp.com is deleted

@tirumaraiselvan tirumaraiselvan deleted the triggers_headers branch September 26, 2018 11:45
hasura-bot pushed a commit that referenced this pull request Mar 29, 2024
Most of our span names were in the format `snake_case` and usually
reflected `name_of_the_function`. This is unfriendly, so we've changed
it to match the format used by data connectors, which use a format like
"Database request" or "Waiting for connection".

It would be nice if `Execute request plan for query field` could be
`Execute request plan for query field "person"` but it seems changing
the currently used `&'static str` for `String` causes all sorts of other
lifetime issues, so I suppose we're better including more information as
span attributes instead. Therefore, all our span names need to be pretty
much static (or at least, dynamically chosen from a list of static
names).

Note: I have not changed the `SpanVisibility::Internal` span names for
now. Most of these reflect function names and this is pretty useful IMO.
Happy to change this later if other feel strongly though.
V3_GIT_ORIGIN_REV_ID: f2226b2466e8592676f3f4635d483289f0e3f6aa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c/server Related to server

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants