Skip to content

Commit

Permalink
Add 'tables' config in dataExplorer config (#16)
Browse files Browse the repository at this point in the history
* Add tables container in dataExplorer config

* Comment dataExplorer settings
  • Loading branch information
KapStorm committed Aug 17, 2023
1 parent 662abd6 commit 4b6be66
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 23 deletions.
33 changes: 12 additions & 21 deletions spra-play-server/src/main/resources/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,18 @@ dataExplorer {
baseUrl = "http://localhost:9000"
baseUrl = ${?DATA_EXPLORER_BASE_URL}

users {
tableName = "users"
primaryKeyField = "user_id"
hiddenColumns = ["password", "email"]
nonEditableColumns = ["user_id", "email", "created_at", "verified_on", "name", "last_name"]
canBeDeleted = false
filterableColumns = ["name", "last_name"]
}

user_tokens {
tableName = "user_tokens"
primaryKeyField = "user_token_id"
nonEditableColumns = ["user_token_id", "user_id", "created_at", "expires_at"]
canBeDeleted = false
}

user_logs {
tableName = "user_logs"
primaryKeyField = "user_log_id"
nonEditableColumns = ["user_log_id", "user_id", "created_at"]
canBeDeleted = false
tables {
# here you can define the tables that will be displayed in the data explorer with their
# respective configuration

# users {
# tableName = "users"
# primaryKeyField = "user_id"
# hiddenColumns = ["password", "email"]
# nonEditableColumns = ["user_id", "email", "created_at", "verified_on", "name", "last_name"]
# canBeDeleted = false
# filterableColumns = ["name", "last_name"]
# }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ case class DataExplorerConfig(baseUrl: String, tablesSettings: List[TableSetting
object DataExplorerConfig {
def apply(config: Configuration): DataExplorerConfig = {
val baseUrl = config.get[String]("baseUrl")
val tableNames = config.subKeys.toList.filter(_ != "baseUrl")
val tablesSettings = tableNames.map(config.get[TableSettings](_))
val tablesConfig = config.get[Configuration]("tables")
val tablesName = tablesConfig.subKeys.toList
val tablesSettings = tablesName.map(tablesConfig.get[TableSettings](_))
DataExplorerConfig(baseUrl, tablesSettings)
}
}

0 comments on commit 4b6be66

Please sign in to comment.