It seems a little scary to silently generate a secret here. What about just throwing an exception if SPARK_SECRET is not set? I'm just wondering if maybe this could cause some silent failures that are very hard to debug.