Is it possible to ignore Ember CLI's http-mocks proxy server? - ember-cli

I've created some ember g http-mocks, and they live in my ember app under /server.
I'd also like to be able to run my ember cli app, proxying all api requests to localhost:3000.
It seems if /server exists, ember will use it, regardless of the -proxy flag. I found some discussion about a --no-http-mocks flag near the end of this issue, but I don't think there's a formal proposal yet.
Is there any hackish intermediate way to get ember cli to ignore /server, other than by deleting the entire /server directory?

You could probably set up ember-cli to enable/disable http-mock based on an environments.js variable as described here:
http://discuss.emberjs.com/t/how-to-disable-http-mock-server-within-environment-config-file/6660
Then to manually flip http-mock on and off as you like, pass in a process environment variable when you run your ember serve at command line. Seems like the way to do that is in this SO post:
How to pass API keys in environment variables to Ember CLI using process.env?

Related

How do you configure simple-subscriptions to run using Postgraphile CLI?

I would like to add subscriptions into a react project I have which currently references graphql using the port 5000 endpoint created by running postgraphile. I start this using the command line startup of globally installed (via npm -g postgraphile) postgraphile. This works fine.
Via the documentation (https://www.graphile.org/postgraphile/subscriptions/) I see that I should be able to enable subscriptions via the CLI:-
https://www.graphile.org/postgraphile/subscriptions/#enabling-with-the-cli-1
However when I run this I get the error:-
"Error: Cannot find module '--simple-subscriptions'"
I'm not sure if it's something to do with pg-pubsub. As I installed postgraphile globally, I did the same with pg-pubsub. Therefore rather than:-
postgraphile --plugins #graphile/pg-pubsub --subscriptions --simple-subscriptions etc
I have:-
postgraphile --plugins pg-pubsub --subscriptions --simple-subscriptions etc
However I know it picks up the plugin ok as running it with "-append-plugins MySubscriptionPlugin.js" rather than simple-subscriptions starts the server with "(subscriptions enabled)" listed.
Has anyone managed to get simple subscriptions running via CLI?

Error in Google Cloud Shell Commands while working on the lab (Securing Google Cloud with CFT Scorecard)

I am working in a GCP lab (Securing Google Cloud with CFT Scorecard). All instructions for the lab are given.
First I have to run the following two commands to set environment variables
export GOOGLE_PROJECT=$DEVSHELL_PROJECT_ID
export CAI_BUCKET_NAME=cai-$GOOGLE_PROJECT
In the second command given above I don't know what to replace with my own credentials? May be that is the reason I am getting error.
Now I have to enable the "cloudasset.googleapis.com" gcloud service. For this they gave the following command.
gcloud services enable cloudasset.googleapis.com \
--project $GOOGLE_PROJECT
Error for this is given in the screeshot attached herewith:
Error in the serviec enabling command
Next step is to clone the policy: The given command for that is:
git clone https://github.com/forseti-security/policy-library.git
After that they said: "You realize Policy Library enforces policies that are located in the policy-library/policies/constraints folder, in which case you can copy a sample policy from the samples directory into the constraints directory".
and gave this command:
cp policy-library/samples/storage_blacklist_public.yaml policy-library/policies/constraints/
On running this command I received this:
error on running the directory command
Finally they said "Create the bucket that will hold the data that Cloud Asset Inventory (CAI) will export" and gave the following command:
gsutil mb -l us-central1 -p $GOOGLE_PROJECT gs://$CAI_BUCKET_NAME
I am confused in where to replace my own credentials like in the place of project_Id I wrote my own project id.
Also I don't know these errors are ocurring. Kindly help me.
I'm unable to access the tutorial.
What happens if you run the following:
echo ${DEVSHELL_PROJECT_ID}
I suspect you'll get an empty result because I think this environment variable isn't actually set.
I think it should be:
echo ${DEVSHELL_GCLOUD_CONFIG}
Does that return a result?
If so, perhaps try using that variable instead:
export GOOGLE_PROJECT=${DEVSHELL_GCLOUD_CONFIG}
export CAI_BUCKET_NAME=cai-${GOOGLE_PROJECT}
It's not entirely clear to me why this tutorial is using this approach but, if the above works, it may get you further along.
We're you asked to create a Google Cloud Platform project?
As per the shared error, this seems to be because your env variable GOOGLE_PROJECT is not set. You can verify it by using echo $GOOGLE_PROJECT and seeing whether it returns the project ID or not. You could also use echo $DEVSHELL_PROJECT_ID. If that returns the project ID and the former doesn't, it means that you didn't export the variable as stated at the beginning.
If the problem is that GOOGLE_PROJECT doesn't have any value, there are different approaches on how to solve it.
Set the env variable as you explained at the beginning. Obviously this will only work if the variable DEVSHELL_PROJECT_ID is also set.
export GOOGLE_PROJECT=$DEVSHELL_PROJECT_ID
Manually set the project ID into that variable. This is far from ideal because in Qwiklabs they create a new temporal project on every lab, so this would've only worked if you were still on that project. The project ID can be seen on both of your shared screenshots.
export GOOGLE_PROJECT=qwiklabs-gcp-03-c6e1787dc09e
Avoid using the argument --project. According to the documentation, the aforementioned argument is optional and if none is used the command will take the one by default, which will be on the configuration settings. You can get the current project by using this:
gcloud config get-value project
If the previous command matches the project ID you want to use, you can simply issue the following command:
gcloud services enable cloudasset.googleapis.com
Notice that the project ID is not being explicitly mentioned using --project.
Regarding your issue with the GitHub file, I have checked the repository and the file storage_blacklist_public.yaml doesn't seem to be in the directory policy-library/samples. There seems to be a trace that it was once there, but it isn't anymore, they should probably update the lab as it isn't anymore.
About your credentials confusion, you don't have to use your own project ID, just the one given on your lab. If I recall properly all the needed data should be on the left side of the lab. Still, you shouldn't need to authenticate in a normal situation as you are already logged in your temporal project if you are accessing it form the Cloud Shell, which is where you should be doing all this.
Adding this for the later versions
in the gcloud shell you can set a temp variable for the current project id with
PROJECT_ID="$(gcloud config get-value project)"
then use like
--project ${PROJECT_ID}

Datahandler (TCEmain) in cli_dispatch.phpsh (Extbase Command)

is it possible to to use Datahander Scripts (TCEmain) in a Extbase Command Controller via cli_dispatch.phpsh? I tried but i got no result - no error message and no entry in the tables.
Perhaps there is no backend available in cli scripts ...
Thanks!
You find the documentation for using DataHandler in CLI scripts here.
CLI scripts use the backend user _cli_ (should be created automatically). You can take a look at the source of \TYPO3\CMS\Backend\Console\CliRequestHandler::boot if you're interested in how it works.
You can check the public instance variable $dataHandler->errorLog for any errors, DataHandler won't output anything else.
Mind that cli_dispatch.phpsh & Co. are deprecated, you can already use Symfony Commands in TYPO3 CMS 8.

How to use fastlane behind proxy

I can't find any option about fastlane to set the proxy. So does there has a direct way to solve this?
Thanks very much for any help!
I had the same problem and for me this site helped as fastlane is using Faraday internally. You have to set up the proxy environment variables for faraday with the following commands:
$ export http_proxy="http://proxy_host:proxy_port"
$ export https_proxy="https://proxy_host:proxy_port"
Any of the Fastlane tools that use spaceship (i.e. the Apple APIs) can be proxied using a combination of three environment variables.
SPACESHIP_PROXY: set the http proxy to use (SPACESHIP_PROXY =https://localhost:9090)
SPACESHIP_PROXY_SSL_VERIFY_NONE: when present, disables SSL verification (to allow inspecting HTTPS requests)
SPACESHIP_DEBUG: equivalent to SPACESHIP_PROXY=https://127.0.0.1:8888 SPACESHIP_PROXY_SSL_VERIFY_NONE=1, preconfigured for Charles Proxy defaults.
To use these, set them as environment variables in your shell, or prepend them to any fastlane command. For example, SPACESHIP_PROXY=https://localhost:9090 bundle exec fastlane
Source: Spaceship debugging documentation

Update HTTP Handler - Request Restrictions - Mapping Tab via Powershell or APPCMD

In IIS 7.5, I am trying to update the request restrictions for the handler mappings. I know you can use appcmd or ps and edit the verbs or access, but I want to be able to run a command that will "Invoke handler only if request is mapped to: FILE".
I found this article in technet, which basically will allow me to edit everything except the tab that I need to change.
https://technet.microsoft.com/en-us/library/cc730969(v=ws.10).aspx
For example
appcmd set config /section:handlers /[name=' ImageCopyrightHandler '].verb:GET,HEAD
I've tried pretty much every command I can come up with but none of them seem to work.
This is what I am trying to edit for each handler mapping.
I'd hate to have to do each one manually, since it has to be done on 3 servers are there are 35 isapi module handers in each one. Any ideas?
The attribute you're looking for is resourceType with a value of File
You sir are awesome.
For anyone interested here is the full string that I'm using for each module.
appcmd set config /section:handlers /[name='PageHandlerFactory-ISAPI-4.0_32bit'].resourceType:File