Skip to content
Snippets Groups Projects
Commit 4b6f760c authored by a-ruskomaa's avatar a-ruskomaa
Browse files

Use a static secret key when running on App Engine, otherwise generate a random key.

parent d3553f33
No related branches found
No related tags found
2 merge requests!31Ci bugfix add secret key,!30Replace the randomized secret key with a static key
Pipeline #4330 passed
......@@ -12,18 +12,22 @@ from opencensus.trace.tracer import Tracer
from opencensus.ext.flask.flask_middleware import FlaskMiddleware
from opencensus.trace.samplers import ProbabilitySampler
app = Flask(__name__)
depl_env = os.getenv("DEPLOYMENT_ENVIRONMENT")
if depl_env == 'production' or depl_env == 'staging':
if os.getenv('GAE_ENV', '').startswith('standard'):
client = google.cloud.logging.Client()
handler = CloudLoggingHandler(client)
setup_logging(handler)
logging.getLogger().setLevel(logging.DEBUG)
app = Flask(__name__)
app.config.from_pyfile('config/config.py')
if os.getenv('GAE_ENV', '').startswith('standard'):
logging.info("Loading app configuration from file")
app.config.from_pyfile('config/config.py')
if not app.secret_key:
logging.info("Generating a random secret key")
app.secret_key = os.urandom(16)
def main():
sde = StackdriverExporter(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment