cube-js / cube

📊 Cube — Universal semantic layer platform for AI, BI, spreadsheets, and embedded analytics
https://cube.dev
Other
18.01k stars 1.78k forks source link

Make all configurations available in the config file #1559

Open MattGson opened 3 years ago

MattGson commented 3 years ago

Is your feature request related to a problem? Please describe. We have conventions around app configuration for our existing services which includes using convict to access configuration, either through the environment or arguments.

We would like to avoid having a one off different system for cube where we must opaquely rely on environment variables.

Describe the solution you'd like All configuration options here should be available in the cube.js/cube.ts file so that we can decide how to populate these values.

Describe alternatives you've considered Using environment variables as cube intends.

keydunov commented 3 years ago

@MattGson we want to match all the env vars with the corresponding config options in cube.js/cube.ts. Could you please share what is missing right now for you?

MattGson commented 3 years ago

@keydunov The main things missing seem to be the database connection args and CUBEJS_DEV_MODE which I personally think should just use NODE_ENV anyway as is the node.js convention.

benswinburne commented 3 years ago

@MattGson for the database connection args can you not just use

  driverFactory: () =>
    new AthenaDriver({
      readOnly: true,
      accessKeyId: process.env.CUBEJS_AWS_KEY,
      secretAccessKey: process.env.CUBEJS_AWS_SECRET,
      region: process.env.CUBEJS_AWS_REGION,
      S3OutputLocation: process.env.CUBEJS_AWS_S3_OUTPUT_LOCATION,
    }),

// or

  driverFactory: () =>
    new MySqlDriver({
      host: process.env.CUBEJS_DB_HOST, // or whatever var/function call etc here
      database: process.env.CUBEJS_DB_NAME,
      user: process.env.CUBEJS_DB_USER,
      password: process.env.CUBEJS_DB_PASS,
      port: process.env.CUBEJS_DB_PORT 
    }),
MattGson commented 3 years ago

Used driverFactory

MattGson commented 3 years ago

There is still some config not available such as redis.