umami icon indicating copy to clipboard operation
umami copied to clipboard

Script for adding users

Open twiesing opened this issue 4 years ago • 3 comments

Hey,

to automatically create the first user (or even more) via environment variables (e.g. Docker), it would be good if there was a corresponding script. Currently, the default user is in the SQL file.

The following parameters would be good:

  • username
  • Password
  • optional: admin

Are there any plans for this?

Tobias

twiesing avatar Sep 21 '21 10:09 twiesing

Is there a reason you're not doing it through the UI interface? Otherwise your options are,

  1. Use admin UI
  2. Manually insert into the database
  3. Run a script

For 3 we would have to create a new script. There is already a script for changing passwords so it should be doable.

mikecao avatar Sep 29 '21 23:09 mikecao

how does the changing passwords run?

not shown here

 npm run-script
Lifecycle scripts included in umami:
  start
    next start

available via `npm run-script`:
  dev
    next dev
  build
    npm-run-all build-tracker build-lang build-geo build-db build-app
  start-env
    node -r dotenv/config scripts/start-env.js
  build-app
    next build
  build-tracker
    rollup -c rollup.tracker.config.js
  build-db
    npm-run-all copy-db-schema build-db-client
  build-lang
    npm-run-all format-lang compile-lang
  build-geo
    node scripts/build-geo.js
  build-db-schema
    dotenv prisma introspect
  build-db-client
    dotenv prisma generate
  build-mysql-schema
    dotenv prisma introspect -- --schema=./prisma/schema.mysql.prisma
  build-mysql-client
    dotenv prisma generate -- --schema=./prisma/schema.mysql.prisma
  build-postgresql-schema
    dotenv prisma introspect -- --schema=./prisma/schema.postgresql.prisma
  build-postgresql-client
    dotenv prisma generate -- --schema=./prisma/schema.postgresql.prisma
  copy-db-schema
    node scripts/copy-db-schema.js
  generate-lang
    npm-run-all extract-lang merge-lang
  extract-lang
    formatjs extract '{pages,components}/**/*.js' --out-file build/messages.json
  merge-lang
    node scripts/merge-lang.js
  format-lang
    node scripts/format-lang.js
  compile-lang
    formatjs compile-folder --ast build public/lang
  check-lang
    node scripts/check-lang.js
  download-country-names
    node scripts/download-country-names.js
  loadtest
    node scripts/loadtest.js
  loadtest:medium
    node scripts/loadtest.js --weight=medium
  loadtest:heavy
    node scripts/loadtest.js --weight=heavy --verbose

rosscdh avatar Oct 28 '21 09:10 rosscdh

@rosscdh node scripts/change-password.js

mikecao avatar Jan 05 '22 01:01 mikecao