Skip to content
This repository has been archived by the owner on Dec 31, 2023. It is now read-only.

Configuration

Tadaya Tsuyukubo edited this page Jan 31, 2014 · 10 revisions

"Evernote REST Webapp" is built on "Spring Boot" and uses many infrastructure from it.
If you need to configure infrastructure related behavior, please also reference the Spring Boot Documentation.

Configuration File

application.properties(or application.yml) file is used for configuring application.

If application is started from executable war file (java -jar evernote-rest-webapp) , it will search application.properties file in this order:

  1. classpath root
  2. current directory
  3. classpath /config package
  4. /config subdir of the current directory.

Thus, place the application.properties to one of the search path directories.

Please see more detail on Spring-Boot doc (see "Externalized Configuration" section).

Configure Deployed War

When you are deploying the "Evernote REST Webapp" to a servlet container, you may need to specify external configuration file in different way.

One approach is to specify "spring.config.location" system property in your servlet container.

For example, in tomcat:

"CATALINA_HOME/bin/setenv.sh"

export CATALINA_OPTS="-Dspring.config.location=file:/usr/local/myapp/application.properties"

* The value of system property is evaluated as spring resource style format.
So, if you are specifying a file outside of classpath, you need to put "file:" prefix.

Configuration Entries

In application.properties, you can specify these entries.
All "Evernote REST Webapp" related configurations start with evernote.

evernote.consumerKey

"Consumer Key" provided by evernote.

Default: None (Required)
Alias: evernote.consumer_key

evernote.consumerSecret

"Consumer Secret" provided by evernote.

Default: None (Required)
Alias: evernote.consumer_secret

evernote.environment

Evernote servers.

Default: SANDBOX
Value: SANDBOX, PRODUCTION, or YINXIANG

evernote.alwaysUseTokenFromConfig

Always use access token specified in config file. When this is true, user specified access token in http header (evernote-rest-accesstoken) will be ignored.
Mainly development purpose.

Default: false
Value: true or false
Alias: evernote.always_use_token_from_config

evernote.accessToken

You can specify your developer token.

Default: None
Alias: evernote.access_token

evernote.fallbackToTokenFromConfig

When http request doesn't provide access-token in header(evernote-rest-accesstoken), use access-token from config.
Good for development.

Default: false
Value: true or false
Alias: evernote.fallback_to_token_from_config

evernote.userAgent

Set custom user agent to the evernote thrift call.

Default: None
Alias: evernote.user_agent

evernote.customHeaders

Set custom header values to the evernote thrift call.

Default: None
Value: Key-Value strings
Alias: evernote.custom_headers

Example:

evernote.customHeaders['foo']=FOO
evernote.custom_headers.bar=BAR

Configurations from Spring Boot

Spring Boot also provide many configuration entries. Here, list only part of them.
Please reference Spring Boot project for more detail.

http.mappers.jsonPrettyPrint

This enables output json to be formatted.

Default: false
Value: true or false
Alias: http.mappers.json_pretty_print

Sample "aplication.properties"

  • "application.properties":
evernote.consumerKey=foo
evernote.consumerSecret=foo-secret
evernote.environment=SANDBOX
evernote.always_use_token_from_config=false
evernote.access_token=foo-access-token
evernote.fallback_to_token_from_config=true