I'm checking out GAE Managed VMs using app.yaml, as described here https://cloud.google.com/appengine/docs/managed-vms/java/configuring-your-app-with-app-yaml
When I do
env_variables:
java.util.logging.config.file: 'WEB-INF/logging.properties'
I get exception
google.appengine.api.yaml_errors.EventError: Value 'java.util.logging.config.file' for key in EnvironmentVariables does not match expression '^(?:[a-zA-Z_][a-zA-Z0-9_]*)$'
Is there any way to specify custom logging.properties through app.yaml?
Try this:
env_variables:
JAVA_USER_OPTS: -Djava.util.logging.config.file=webapps/root/WEB-INF/logging.properties
The env_variables section in app.yaml is for setting environment variables. Dots are not allowed in their names, so the exception makes sense.
You are trying to set java.util.logging.config.file, which is a system property, not an environment variable. To set it you need to provide -Djava.util.logging.config.file=<value> argument when starting Java. GAE Flexible image provides JAVA_USER_OPTS environment variable to customise Java command line, so you can use it to customise JUL settings (as is now also recommended in the image readme).
Also, WEB-INF/logging.properties value didn't work for me as the current dir is $JETTY_BASE, not $JETTY_BASE/webapps/root.
The other answer is no longer correct. The property name is now named JAVA_OPTS
Full 'secret' variable names here
https://github.com/GoogleCloudPlatform/jetty-runtime#providing-loggingproperties-via-the-web-application
This is the correct setting now:
env_variables:
JAVA_OPTS: -Djava.util.logging.config.file=webapps/root/WEB-INF/logging.properties
For the Generally Available Flexible Environment, use this format.
env_variables:
JETTY_ARGS: -Djava.util.logging.config.file=WEB-INF/logging.properties
See here .
Related
Issue details
.env value not initialized in the react property
siteKey value is always blank
Property in react
const [siteKey] = useState(process.env.REACT_CAPTCHA_SITE_KEY);
Key in .env
REACT_CAPTCHA_SITE_KEY='some key'
Html
<ReCAPTCHA sitekey={siteKey}/>
Main issue is with your environment declaration, as per create-react-app:
You must create custom environment variables beginning with
REACT_APP_. Any other variables except NODE_ENV will be ignored to
avoid accidentally exposing a private key on the machine that could
have the same name. Changing any environment variables will require
you to restart the development server if it is running.
As you don't have any setter method needed for useState, you can define your variable just with const, like:
const siteKey = process.env.REACT_APP_CAPTCHA_SITE_KEY
I saw Some Issue in your code, First thing is,UseState hook initialization is wrong.
It Should be,
const [siteKey, setsiteKey] = useState(process.env.REACT_APP_CAPTCHA_SITE_KEY);
And also You don't need to use this environment variable as useState, because it is not changing so, when you need to access environment variable, use as below,
ex:const siteKey=process.env.REACT_APP_CAPTCHA_SITE_KEY;
Other Important Issues are,
Your environment variable should prefix with the REACT_APP_ in the .env file.
ex:process.env.REACT_APP_SOME_VARIABLE
And possible Issue can be, your .env file is not in your root which is that, within the same directory as the package. json file.
Key in .env should be like as shown below
REACT_APP_CAPTCHA_SITE_KEY=some_key_value
Also whenever you edit your .env file you need to restart your React app to take effect of your modified file.
When deploying Flink Stateful Functions, one needs to specify what the endpoints for the functions are, i.e. what URL does Flink need to hit in order to trigger the execution of a remote function.
The docs state:
The URL template name may contain template parameters that are filled
in based on the function’s specific type. For example, a message sent
to message type com.example/greeter will be sent to
http://bar.foo.com/greeter.
endpoints:
- endpoint:
meta:
kind: http
spec:
functions: com.example/*
urlPathTemplate: https://bar.foo.com/{function.name}
What other templating values does the urlPathTemplate support and where are these values taken from?
The only template value supported at the moment is the function name. i.e. the last value after the last forward slash /. You can place it wherever you would like in the template as long as it would resolve to a legal url at the end.
For example, this is also a valid template:
http://{function.name}.prod.svc.example.com
Then, a message address to com.example/greeter (in your example, with my new template) would resolve to:
http://greeter.prod.svc.example.com
If you are missing any other template parameters, feel free to connect with the Flink community over the user mailing list/JIRA. I'm sure they would be happy to learn about new uses cases ;-)
According to the official documentation of Next.js, to expose an environment variable is necessary to use NEXT_PUBLIC_ prefix, but the admin uses process.env.REACT_APP_API_ENTRYPOINT.
In my case to access the REACT_APP_API_ENTRYPOINT env var, I needed to substitute to process.env.NEXT_PUBLIC_REACT_APP_API_ENTRYPOINT. Only with this pwa can access the value.
Is that right or am I making a mistake in changing this value?
You are right partially, Next exposes env variables that has a prefix NEXT_PUBLIC_ automatically, if your app expects to get REACT_APP_API_ENTRYPOINT, there is no point of renaming the variable, since your app won't consume it.
If I understood your scenario correctly, you need to expose REACT_APP_API_ENTRYPOINT, since next doesn't do it automatically, you need to specify if manually in your next.config.js file.
//next.config.js
module.exports = {
...
env: {
REACT_APP_API_ENTRYPOINT: process.env.REACT_APP_API_ENTRYPOINT, // assumes that your variable is defined
}
...
}
My attempt at matching a regex as directory name in app.yaml doesn't work :
- url: /v1_.*
static_dir: static/v1
expiration: "364d"
Although this official spec says regex syntax is supported. Is there a way to make this work ?
I.e. /v1_2014-01-29/img/logo.png should match the static file /static/v1/img/logo.png.
Trivia
I use Google App Engine to serve a Go webapp.
I'd like to maximize browser cache longevity, minimize number of requests and still serve the fresh versions of my css/js/png, and I believe revving filenames is a best practice to achieve this. Also as adding a variable querystring (/v1/img/logo.png?2014-01-29) might cause proxy and cache problems, I prefer to show a variable directory name (/v1_2014-01-29/img/logo.png), pointing to the same underlying server dir.
Seems to me that whatever part of the URL that is beyond the match of the url definition (which matches from the start) is appended to the static_dir.
So the following handler should match /v1_2014-01-29/img/logo.png if the file path is static/v1/img/logo.png (tried with Python):
- url: /v1_(\d+-?)+
static_dir: static/v1
After olivierdm's answer I changed my yaml into :
- url: /v1_.*_
static_dir: static/v1
expiration: "364d"
and my html templates to produce /v1_2014-01-29_/img/logo.png.
Basically, the extra arbitrary character underscore _ forces .* to match 2014-01-29, not the empty string.
Now every time I want the visitors to reload the static files, I just change the date in the tempating (I don't touch the app.yaml anymore). Also, any accidental request to an "outdated" URL will still succeed and serve the fresh resource.
Using bulkloader in App Engine, I can get properties set to certain values or to None (or null value). I can also leave them unset if I don't include the property in bulkloader.yaml.
What I would like to do is set the property for some of the entities and leave the property unset for some other entities. Is there a way to do this?
There's no way to do this with the standard YAML configuration of the bulkloader. Note, though, that most model frameworks, including the Python one built in to App Engine, will create any missing properties when you first write a record with them, so there's not much point in going out of your way to leave them unspecified.
You can do this with a post_import_function.
Let's say you have a string property called "notes" that should be omitted if empty:
def post_process_entity(input_dict, instance, bulkload_state):
if instance['notes'] == '':
del instance['notes']
return instance