Skip to content

Commit

Permalink
fix: username conf not taken into account
Browse files Browse the repository at this point in the history
  • Loading branch information
ptitFicus committed Sep 18, 2024
1 parent 5e5ab2b commit 362a90d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/fr/maif/izanami/env/postgresql.scala
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class Postgresql(env: Env) {
.baselineOnMigrate(true)
.schemas("izanami")
.placeholders(
java.util.Map.of("default_admin", "RESERVED_ADMIN_USER", "default_password", HashUtils.bcryptHash(password))
java.util.Map.of("default_admin", defaultUser, "default_password", HashUtils.bcryptHash(password))
)
.load()

Expand Down Expand Up @@ -168,6 +168,11 @@ class Postgresql(env: Env) {
maybeUserProvidedPassword.getOrElse(IdGenerator.token(24))
}

def defaultUser: String = {
val maybeUserAdminUser = configuration.getOptional[String]("app.admin.username")
maybeUserAdminUser.getOrElse("RESERVED_ADMIN_USER")
}

def onStop(): Future[Unit] = {
pool.close()
FastFuture.successful(())
Expand Down
1 change: 1 addition & 0 deletions conf/dev.conf
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ app {
email-field = email
}
admin {
username = "izanami"
password = "ADMIN_DEFAULT_PASSWORD"
}
exposition {
Expand Down
10 changes: 10 additions & 0 deletions manual/docs/04-guides/12-configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ You can either provide a connection URI, or indicate database name, user, host,
| Log activity | IZANAMI_PG_LOG_ACTIVITY | app.pg.log-activity | false |
| Pipelining limit | IZANAMI_PG_PIPELINING_LIMIT | app.pg.pipelining-limit | 256 |

### HTTP server

Since Izanami uses play framework under the hood, http server configuration rely heavily on play configuration keys.

Table above list essentials parameters, check [Play documentation](https://www.playframework.com/documentation/2.9.x/SettingsAkkaHttp) for more.

| | Environnement variable | Program argument | Default |
| ---- | ---------------------- | --------------------- | ------- |
| Port | PLAY_HTTP_PORT | play.server.http.port | 9000 |

### Admin account

When creating on an empty database, Izanami will create a user for you.
Expand Down
10 changes: 10 additions & 0 deletions manual/docs/06-dev/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,13 @@ To test docker image
```sh
docker run --env IZANAMI_PG_URI=postgresql://postgres:[email protected]:5432/postgres -p 9000:9000 izanami
```

## Running documentation locally

To run documentation, just install and start project in `manual` folder.

```sh
cd manual
npm i
npm start
```

0 comments on commit 362a90d

Please sign in to comment.