silverstripe / silverstripe-graphql

Serves Silverstripe data as GraphQL representations
BSD 3-Clause "New" or "Revised" License
52 stars 61 forks source link

Let Allow-Origin: * pass for CLI? #193

Open michalkleiner opened 5 years ago

michalkleiner commented 5 years ago

Should queries run via sake/CLI be considered for Origin checking?

If so, which of the below would be the preferred option to go with?

a) Document mechanism how to set Origin via CLI or config b) Auto fallback to SS_BASE_URL when CLI is detected c) Update Origin check to allow for empty Origin to be considered for check (not directly rejected) and be covered by '*' as well as '' config options.

robbieaverill commented 5 years ago

I'm curious what the use case would be for doing this

michalkleiner commented 5 years ago

At the moment I just want to run graphql queries via sake for development. You can e.g. have a file watcher trigger sake commands on php file change, so without going and manually refreshing you can immediately see if the query still works or if it broke. Just as an example. Or have cron run sake to do whatever with the graphql endpoint, mutations, pre-caching or so. There are usecases I would say.

Generally, it seems like the controller is probably too dependant on a proper client or the dev tool querying it.

robbieaverill commented 5 years ago

Cool, interesting use cases that we probably hadn’t considered. I’ll triage this as an enhancement if that’s ok

michalkleiner commented 5 years ago

Cool. It will also get a valid Member to work with so that operations can be verified if needed. For now I'm just logging in default admin for CLI tasks in dev mode.