diff --git a/.cljstyle b/.cljstyle index ffba6fb0..3b66867e 100644 --- a/.cljstyle +++ b/.cljstyle @@ -1,14 +1,15 @@ -{:rules - {:whitespace {:remove-surrounding? true - :remove-trailing? true - :insert-missing? true} - :blank-lines {:padding-lines 1 - :max-consecutive 1 - :insert-padding true - :trim-consecutive? true} - :types {:enabled? false} - :functions {:enabled? false} - :eof-new-line {:enabled? true} - :namespaces {:enabled? true - :break-libs true - :indent-size 2}}} +{:files {:ignore #{"checkouts" "target"} + :extensions #{"clj" "edn"}} + :rules {:whitespace {:remove-surrounding? true + :remove-trailing? true + :insert-missing? true} + :blank-lines {:padding-lines 1 + :max-consecutive 1 + :insert-padding true + :trim-consecutive? true} + :types {:enabled? false} + :functions {:enabled? false} + :eof-new-line {:enabled? true} + :namespaces {:enabled? true + :break-libs true + :indent-size 2}}} diff --git a/config/dev/config.edn b/config/dev/config.edn index 7f92ec80..738cd9c3 100644 --- a/config/dev/config.edn +++ b/config/dev/config.edn @@ -1,25 +1,25 @@ -{:framework.db.storage/postgresql {:port 5432 - :dbname "framework" - :host "localhost" - :dbtype "postgresql" - :user "postgres" - :password "postgres"} - :framework.app/web-server {:port 3000 - :join? false} - :framework.db.storage/migration {:store :database - :migration-dir "resources/migrations" - :init-in-transaction? false - :migration-table-name "migrations"} - :framework.app/emails {:host "" - :user "" - :pass "" - :tls true - :port 587 - :from ""} - :framework.app/auth {:hash-algorithm :bcrypt ;; Available values: :bcrypt, :scrypt, and :pbkdf2 - :bcrypt-settings {:work-factor 11} - :scrypt-settings {:cpu-cost 32768 ;; Must be a power of 2 - :memory-cost 8 - :parallelization 1} - :pbkdf2-settings {:type :sha1 ;; Available values: :sha1 and :sha256 - :iterations 100000}}} +{:xiana/postgresql {:port 5432 + :dbname "framework" + :host "localhost" + :dbtype "postgresql" + :user "postgres" + :password "postgres"} + :xiana/web-server {:port 3000 + :join? false} + :xiana/migration {:store :database + :migration-dir "resources/migrations" + :init-in-transaction? false + :migration-table-name "migrations"} + :xiana/emails {:host "" + :user "" + :pass "" + :tls true + :port 587 + :from ""} + :xiana/auth {:hash-algorithm :bcrypt ; Available values: :bcrypt, :scrypt, and :pbkdf2 + :bcrypt-settings {:work-factor 11} + :scrypt-settings {:cpu-cost 32768 ; Must be a power of 2 + :memory-cost 8 + :parallelization 1} + :pbkdf2-settings {:type :sha1 ; Available values: :sha1 and :sha256 + :iterations 100000}}} diff --git a/config/test/config.edn b/config/test/config.edn index ad63b70e..fbf1f95b 100644 --- a/config/test/config.edn +++ b/config/test/config.edn @@ -1,26 +1,26 @@ -{:framework.db.storage/postgresql {:image-name "postgres:14-alpine" - :port 5432 - :dbname "framework" - :host "localhost" - :dbtype "postgresql" - :user "postgres" - :password "postgres"} - :framework.app/web-server {:port 3333 - :join? false} - :framework.db.storage/migration {:store :database - :migration-dir "resources/migrations" - :init-in-transaction? false - :migration-table-name "migrations"} - :framework.app/emails {:host "" - :user "" - :pass "" - :tls true - :port 587 - :from ""} - :framework.app/auth {:hash-algorithm :bcrypt ;; Available values: :bcrypt, :scrypt, and :pbkdf2 - :bcrypt-settings {:work-factor 11} - :scrypt-settings {:cpu-cost 32768 ;; Must be a power of 2 - :memory-cost 8 - :parallelization 1} - :pbkdf2-settings {:type :sha1 ;; Available values: :sha1 and :sha256 - :iterations 100000}}} +{:xiana/postgresql {:image-name "postgres:14-alpine" + :port 5432 + :dbname "framework" + :host "localhost" + :dbtype "postgresql" + :user "postgres" + :password "postgres"} + :xiana/web-server {:port 3333 + :join? false} + :xiana/migration {:store :database + :migration-dir "resources/migrations" + :init-in-transaction? false + :migration-table-name "migrations"} + :xiana/emails {:host "" + :user "" + :pass "" + :tls true + :port 587 + :from ""} + :xiana/auth {:hash-algorithm :bcrypt ; Available values: :bcrypt, :scrypt, and :pbkdf2 + :bcrypt-settings {:work-factor 11} + :scrypt-settings {:cpu-cost 32768 ; Must be a power of 2 + :memory-cost 8 + :parallelization 1} + :pbkdf2-settings {:type :sha1 ; Available values: :sha1 and :sha256 + :iterations 100000}}} diff --git a/examples/.gitignore b/examples/.gitignore new file mode 100644 index 00000000..7ea195e6 --- /dev/null +++ b/examples/.gitignore @@ -0,0 +1,3 @@ +*/.shadow-cljs/ +*/node_modules/ +*/resources/public/js/ diff --git a/examples/acl/Docker/db.Dockerfile b/examples/acl/Docker/db.Dockerfile deleted file mode 100644 index 39bc52c6..00000000 --- a/examples/acl/Docker/db.Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM postgres:14-alpine -COPY init.sql /docker-entrypoint-initdb.d/ diff --git a/examples/acl/Docker/init.sql b/examples/acl/Docker/init.sql deleted file mode 100644 index 5f22ecf7..00000000 --- a/examples/acl/Docker/init.sql +++ /dev/null @@ -1,2 +0,0 @@ -CREATE DATABASE acl; -GRANT ALL PRIVILEGES ON DATABASE acl TO postgres; diff --git a/examples/acl/README.md b/examples/acl/README.md index e9178f5f..d56d229d 100644 --- a/examples/acl/README.md +++ b/examples/acl/README.md @@ -6,8 +6,9 @@ API implementation for ACL example ### Prepare -- start postgres with docker-compose, or with `postgres-start.sh` shell-script -- apply tables and default users with `lein migratus migrate` +start postgres with docker-compose: + + docker compose up -d ### Run application diff --git a/examples/acl/config/dev/config.edn b/examples/acl/config/dev/config.edn index c7a2084e..41330e82 100644 --- a/examples/acl/config/dev/config.edn +++ b/examples/acl/config/dev/config.edn @@ -1,77 +1,59 @@ -{:framework.db.storage/postgresql {:port 5433 - :dbname "acl" - :host "localhost" - :dbtype "postgresql" - :user "postgres" - :password "postgres"} +{:xiana/postgresql {:port 5433 + :dbname "acl" + :host "localhost" + :dbtype "postgresql" + :user "postgres" + :password "postgres"} - :framework.db.storage/migration {:store :database - :migration-dir "resources/migrations" - :init-in-transaction? false - :migration-table-name "migrations"} + :xiana/migration {:store :database + :migration-dir "resources/migrations" + :init-in-transaction? false + :migration-table-name "migrations"} - :framework.app/ring {:defaults {:params {:urlencoded true - :multipart true - :nested true - :keywordize true} - :cookies true - :session {:flash true - :cookie-attrs - {:http-only true, :same-site :strict}} - :security {:anti-forgery true - :xss-protection - {:enable? true, :mode :block} - :frame-options :sameorigin - :content-type-options :nosniff} - :static {:resources "public"} - :responses {:not-modified-responses true - :absolute-redirects true - :content-types true}}} - - :framework.app/web-server {:port 3000 - :join? false} - :framework.app/role-set {:resources [:posts :comments :users] - :actions {:posts [:read :create :update :delete :comment :react] - :comments [:read :create :update :delete :reply :react] - :users [:read :create :update :delete :ban]} - :roles {:guest {:posts {:read :all} - :comments {:read :all}} - :member {:posts {:read :all - :comment :friends - :react :friends - :create :own - :update :own - :delete :own} - :comments {:read :all - :create :own - :update :own - :delete :own - :reply :friends - :react :friends} - :users {:read :all - :create :own - :update :own - :delete :own}} - :staff {:posts {:read :all - :delete :all} - :comments {:read :all - :delete :all} - :users {:read :all - :delete :ban}} - :superuser {:posts {:read :all - :comment :all - :react :all - :create :all - :update :all - :delete :all} - :comments {:read :all - :create :all - :update :all - :delete :all - :reply :all - :react :all} - :users {:read :all - :create :all - :update :all - :delete :all - :ban :all}}}}} + :xiana/web-server {:port 3000 + :join? false} + :xiana/role-set {:resources [:posts :comments :users] + :actions {:posts [:read :create :update :delete :comment :react] + :comments [:read :create :update :delete :reply :react] + :users [:read :create :update :delete :ban]} + :roles {:guest {:posts {:read :all} + :comments {:read :all}} + :member {:posts {:read :all + :comment :friends + :react :friends + :create :own + :update :own + :delete :own} + :comments {:read :all + :create :own + :update :own + :delete :own + :reply :friends + :react :friends} + :users {:read :all + :create :own + :update :own + :delete :own}} + :staff {:posts {:read :all + :delete :all} + :comments {:read :all + :delete :all} + :users {:read :all + :delete :ban}} + :superuser {:posts {:read :all + :comment :all + :react :all + :create :all + :update :all + :delete :all} + :comments {:read :all + :create :all + :update :all + :delete :all + :reply :all + :react :all} + :users {:read :all + :create :all + :update :all + :delete :all + :ban :all}}}}} diff --git a/examples/acl/config/test/config.edn b/examples/acl/config/test/config.edn index 42f2e235..7b737437 100644 --- a/examples/acl/config/test/config.edn +++ b/examples/acl/config/test/config.edn @@ -1,75 +1,58 @@ -{:framework.db.storage/postgresql {:image-name "postgres:14-alpine" - :port 5433 - :dbname "acl" - :host "localhost" - :dbtype "postgresql" - :user "postgres" - :password "postgres"} - :framework.db.storage/migration {:store :database - :migration-dir "resources/migrations" - :init-in-transaction? false - :migration-table-name "migrations"} - :framework.app/ring {:defaults {:params {:urlencoded true - :multipart true - :nested true - :keywordize true} - :cookies true - :session {:flash true - :cookie-attrs - {:http-only true, :same-site :strict}} - :security {:anti-forgery true - :xss-protection - {:enable? true, :mode :block} - :frame-options :sameorigin - :content-type-options :nosniff} - :static {:resources "public"} - :responses {:not-modified-responses true - :absolute-redirects true - :content-types true}}} - :framework.app/web-server {:port 3333 - :join? false} - :framework.app/role-set {:resources [:posts :comments :users] - :actions {:posts [:read :create :update :delete :comment :react] - :comments [:read :create :update :delete :reply :react] - :users [:read :create :update :delete :ban]} - :roles {:guest {:posts {:read :all} - :comments {:read :all}} - :member {:posts {:read :all - :comment :friends - :react :friends - :create :own - :update :own - :delete :own} - :comments {:read :all - :create :own - :update :own - :delete :own - :reply :friends - :react :friends} - :users {:read :all - :create :own - :update :own - :delete :own}} - :staff {:posts {:read :all - :delete :all} - :comments {:read :all - :delete :all} - :users {:read :all - :delete :ban}} - :superuser {:posts {:read :all - :comment :all - :react :all - :create :all - :update :all - :delete :all} - :comments {:read :all - :create :all - :update :all - :delete :all - :reply :all - :react :all} - :users {:read :all - :create :all - :update :all - :delete :all - :ban :all}}}}} +{:xiana/postgresql {:image-name "postgres:14-alpine" + :port 5433 + :dbname "acl" + :host "localhost" + :dbtype "postgresql" + :user "postgres" + :password "postgres"} + :xiana/migration {:store :database + :migration-dir "resources/migrations" + :init-in-transaction? false + :migration-table-name "migrations"} + :xiana/web-server {:port 3333 + :join? false} + :xiana/role-set {:resources [:posts :comments :users] + :actions {:posts [:read :create :update :delete :comment :react] + :comments [:read :create :update :delete :reply :react] + :users [:read :create :update :delete :ban]} + :roles {:guest {:posts {:read :all} + :comments {:read :all}} + :member {:posts {:read :all + :comment :friends + :react :friends + :create :own + :update :own + :delete :own} + :comments {:read :all + :create :own + :update :own + :delete :own + :reply :friends + :react :friends} + :users {:read :all + :create :own + :update :own + :delete :own}} + :staff {:posts {:read :all + :delete :all} + :comments {:read :all + :delete :all} + :users {:read :all + :delete :ban}} + :superuser {:posts {:read :all + :comment :all + :react :all + :create :all + :update :all + :delete :all} + :comments {:read :all + :create :all + :update :all + :delete :all + :reply :all + :react :all} + :users {:read :all + :create :all + :update :all + :delete :all + :ban :all}}}}} diff --git a/examples/acl/docker-compose.yml b/examples/acl/docker-compose.yml index 0cafa073..914312bb 100644 --- a/examples/acl/docker-compose.yml +++ b/examples/acl/docker-compose.yml @@ -1,9 +1,11 @@ version: "3.3" services: db: - build: - context: ./Docker - dockerfile: db.Dockerfile + image: postgres:14-alpine + environment: + - POSTGRES_DB=acl + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=postgres volumes: - db-data:/var/lib/postgresql/data ports: diff --git a/examples/acl/postgres-start.sh b/examples/acl/postgres-start.sh deleted file mode 100755 index 066dd76e..00000000 --- a/examples/acl/postgres-start.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -docker-compose -f docker-compose.yml up --no-start -docker-compose -f docker-compose.yml start diff --git a/examples/acl/project.clj b/examples/acl/project.clj index d34bb3b0..1c3ae9d5 100644 --- a/examples/acl/project.clj +++ b/examples/acl/project.clj @@ -2,7 +2,7 @@ :description "FIXME: write description" :min-lein-version "2.0.0" :dependencies [[org.clojure/clojure "1.10.3"] - [com.flexiana/framework "0.3.4"] + [com.flexiana/framework "0.4.0-rc1"] [thheller/shadow-cljs "2.11.7"] [migratus "1.3.5"] [clj-http "3.12.0"] diff --git a/examples/cli-chat/Docker/db.Dockerfile b/examples/cli-chat/Docker/db.Dockerfile deleted file mode 100644 index 39bc52c6..00000000 --- a/examples/cli-chat/Docker/db.Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM postgres:14-alpine -COPY init.sql /docker-entrypoint-initdb.d/ diff --git a/examples/cli-chat/Docker/init.sql b/examples/cli-chat/Docker/init.sql deleted file mode 100644 index 198a06d7..00000000 --- a/examples/cli-chat/Docker/init.sql +++ /dev/null @@ -1,6 +0,0 @@ -CREATE DATABASE cli_chat; -GRANT ALL PRIVILEGES ON DATABASE cli_chat TO postgres; - -DROP DATABASE IF EXISTS cli_chat_test; -CREATE DATABASE cli_chat_test; -GRANT ALL PRIVILEGES ON DATABASE cli_chat_test TO postgres; diff --git a/examples/cli-chat/README.md b/examples/cli-chat/README.md index 7a866ef6..ac721dee 100644 --- a/examples/cli-chat/README.md +++ b/examples/cli-chat/README.md @@ -6,7 +6,7 @@ Websockets based chat server example implementation ### Start dockerized PostgreSQL ```shell -./postgres-start.sh +docker compose up -d ``` ### Log into psql console diff --git a/examples/cli-chat/config/dev/config.edn b/examples/cli-chat/config/dev/config.edn index 8b50c3c4..963a283d 100644 --- a/examples/cli-chat/config/dev/config.edn +++ b/examples/cli-chat/config/dev/config.edn @@ -1,40 +1,22 @@ -{:framework.db.storage/postgresql {:port 5433 - :dbname "cli_chat" - :host "localhost" - :dbtype "postgresql" - :user "postgres" - :password "postgres"} +{:xiana/postgresql {:port 5433 + :dbname "cli_chat" + :host "localhost" + :dbtype "postgresql" + :user "postgres" + :password "postgres"} - :framework.db.storage/migration {:store :database - :migration-dir "resources/migrations" - :init-in-transaction? false - :migration-table-name "migrations"} + :xiana/migration {:store :database + :migration-dir "resources/migrations" + :init-in-transaction? false + :migration-table-name "migrations"} - :framework.app/ring {:defaults {:params {:urlencoded true - :multipart true - :nested true - :keywordize true} - :cookies true - :session {:flash true - :cookie-attrs - {:http-only true, :same-site :strict}} - :security {:anti-forgery true - :xss-protection - {:enable? true, :mode :block} - :frame-options :sameorigin - :content-type-options :nosniff} - :static {:resources "public"} - :responses {:not-modified-responses true - :absolute-redirects true - :content-types true}}} + :xiana/web-server {:port 3000 + :join? false} - :framework.app/web-server {:port 3000 - :join? false} - - :framework.app/auth {:hash-algorithm :bcrypt ;; Available values: :bcrypt, :scrypt, and :pbkdf2 - :bcrypt-settings {:work-factor 11} - :scrypt-settings {:cpu-cost 32768 ;; Must be a power of 2 - :memory-cost 8 - :parallelization 1} - :pbkdf2-settings {:type :sha1 ;; Available values: :sha1 and :sha256 - :iterations 100000}}} + :xiana/auth {:hash-algorithm :bcrypt ; Available values: :bcrypt, :scrypt, and :pbkdf2 + :bcrypt-settings {:work-factor 11} + :scrypt-settings {:cpu-cost 32768 ; Must be a power of 2 + :memory-cost 8 + :parallelization 1} + :pbkdf2-settings {:type :sha1 ; Available values: :sha1 and :sha256 + :iterations 100000}}} diff --git a/examples/cli-chat/config/test/config.edn b/examples/cli-chat/config/test/config.edn index 6913fe90..e67b26fc 100644 --- a/examples/cli-chat/config/test/config.edn +++ b/examples/cli-chat/config/test/config.edn @@ -1,42 +1,24 @@ -{:framework.db.storage/postgresql {:image-name "postgres:14-alpine" - :port 5433 - :dbname "cli_chat_test" - :host "localhost" - :dbtype "postgresql" - :user "postgres" - :password "postgres"} +{:xiana/postgresql {:image-name "postgres:14-alpine" + :port 5433 + :dbname "cli_chat_test" + :host "localhost" + :dbtype "postgresql" + :user "postgres" + :password "postgres"} - :framework.db.storage/migration {:store :database - :migration-dir "resources/migrations" - :init-in-transaction? false - :migration-table-name "migrations"} + :xiana/migration {:store :database + :migration-dir "resources/migrations" + :init-in-transaction? false + :migration-table-name "migrations"} - :framework.app/ring {:defaults {:params {:urlencoded true - :multipart true - :nested true - :keywordize true} - :cookies true - :session {:flash true - :cookie-attrs - {:http-only true, :same-site :strict}} - :security {:anti-forgery true - :xss-protection - {:enable? true, :mode :block} - :frame-options :sameorigin - :content-type-options :nosniff} - :static {:resources "public"} - :responses {:not-modified-responses true - :absolute-redirects true - :content-types true}}} + :xiana/web-server {:port 3333 + :join? false} - :framework.app/web-server {:port 3333 - :join? false} - - :framework.app/auth {:hash-algorithm :bcrypt ;; Available values: :bcrypt, :scrypt, and :pbkdf2 - :bcrypt-settings {:work-factor 11} - :scrypt-settings {:cpu-cost 32768 ;; Must be a power of 2 - :memory-cost 8 - :parallelization 1} - :pbkdf2-settings {:type :sha1 ;; Available values: :sha1 and :sha256 - :iterations 100000}}} + :xiana/auth {:hash-algorithm :bcrypt ; Available values: :bcrypt, :scrypt, and :pbkdf2 + :bcrypt-settings {:work-factor 11} + :scrypt-settings {:cpu-cost 32768 ; Must be a power of 2 + :memory-cost 8 + :parallelization 1} + :pbkdf2-settings {:type :sha1 ; Available values: :sha1 and :sha256 + :iterations 100000}}} diff --git a/examples/cli-chat/docker-compose.yml b/examples/cli-chat/docker-compose.yml index 0cafa073..cca3fcb7 100644 --- a/examples/cli-chat/docker-compose.yml +++ b/examples/cli-chat/docker-compose.yml @@ -1,9 +1,11 @@ version: "3.3" services: db: - build: - context: ./Docker - dockerfile: db.Dockerfile + image: postgres:14-alpine + environment: + - POSTGRES_DB=cli_chat + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=postgres volumes: - db-data:/var/lib/postgresql/data ports: diff --git a/examples/cli-chat/postgres-start.sh b/examples/cli-chat/postgres-start.sh deleted file mode 100755 index 066dd76e..00000000 --- a/examples/cli-chat/postgres-start.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -docker-compose -f docker-compose.yml up --no-start -docker-compose -f docker-compose.yml start diff --git a/examples/cli-chat/project.clj b/examples/cli-chat/project.clj index 6818380a..de69c4a9 100644 --- a/examples/cli-chat/project.clj +++ b/examples/cli-chat/project.clj @@ -2,7 +2,7 @@ :description "FIXME: write description" :min-lein-version "2.0.0" :dependencies [[org.clojure/clojure "1.10.3"] - [com.flexiana/framework "0.3.4"] + [com.flexiana/framework "0.4.0-rc1"] [thheller/shadow-cljs "2.11.26"] [migratus "1.3.5"] [clj-http "3.12.1"] diff --git a/examples/cli-chat/src/backend/cli_chat/core.clj b/examples/cli-chat/src/backend/cli_chat/core.clj index 0a644d35..a877da7b 100644 --- a/examples/cli-chat/src/backend/cli_chat/core.clj +++ b/examples/cli-chat/src/backend/cli_chat/core.clj @@ -28,7 +28,7 @@ db/connect db/migrate! rbac/init - (rename-key :framework.app/auth :auth) + (rename-key :xiana/auth :auth) session/init-backend ws/start closeable-map)) diff --git a/examples/controllers/Docker/db.Dockerfile b/examples/controllers/Docker/db.Dockerfile deleted file mode 100644 index 39bc52c6..00000000 --- a/examples/controllers/Docker/db.Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM postgres:14-alpine -COPY init.sql /docker-entrypoint-initdb.d/ diff --git a/examples/controllers/Docker/init.sql b/examples/controllers/Docker/init.sql deleted file mode 100644 index 22a59c64..00000000 --- a/examples/controllers/Docker/init.sql +++ /dev/null @@ -1,2 +0,0 @@ -CREATE DATABASE controllers; -GRANT ALL PRIVILEGES ON DATABASE controllers TO postgres; diff --git a/examples/controllers/README.md b/examples/controllers/README.md index 0fb15707..1d4b8e11 100644 --- a/examples/controllers/README.md +++ b/examples/controllers/README.md @@ -7,6 +7,8 @@ FIXME: description ### Run the backend ```shell +docker compose up -d + lein run ``` diff --git a/examples/controllers/config/dev/config.edn b/examples/controllers/config/dev/config.edn index 6b94a880..bd38b460 100644 --- a/examples/controllers/config/dev/config.edn +++ b/examples/controllers/config/dev/config.edn @@ -1,33 +1,12 @@ -{:framework.db.storage/postgresql {:port 5432 - :dbname "controllers" - :host "localhost" - :dbtype "postgresql" - :user "postgres" - :password "postgres"} - - :framework.db.storage/migration {:store :database - :migration-dir "resources/migrations" - :init-in-transaction? false - :migration-table-name "migrations"} - - :framework.app/ring {:defaults {:params {:urlencoded true - :multipart true - :nested true - :keywordize true} - :cookies true - :session {:flash true - :cookie-attrs - {:http-only true, :same-site :strict}} - :security {:anti-forgery true - :xss-protection - {:enable? true, :mode :block} - :frame-options :sameorigin - :content-type-options :nosniff} - :static {:resources "public"} - :responses {:not-modified-responses true - :absolute-redirects true - :content-types true}}} - - :framework.app/web-server {:port 3000 - :join? false} - } +{:xiana/postgresql {:port 5432 + :dbname "controllers" + :host "localhost" + :dbtype "postgresql" + :user "postgres" + :password "postgres"} + :xiana/migration {:store :database + :migration-dir "resources/migrations" + :init-in-transaction? false + :migration-table-name "migrations"} + :xiana/web-server {:port 3000 + :join? false}} diff --git a/examples/controllers/config/test/config.edn b/examples/controllers/config/test/config.edn index b794fd55..138cbc8b 100644 --- a/examples/controllers/config/test/config.edn +++ b/examples/controllers/config/test/config.edn @@ -1,28 +1,10 @@ -{:framework.db.storage/postgresql {:image-name "postgres:14-alpine" - :port 5432 - :dbname "controllers" - :host "localhost" - :dbtype "postgresql" - :user "postgres" - :password "postgres"} - - :framework.app/ring {:defaults {:params {:urlencoded true - :multipart true - :nested true - :keywordize true} - :cookies true - :session {:flash true - :cookie-attrs - {:http-only true, :same-site :strict}} - :security {:anti-forgery true - :xss-protection - {:enable? true, :mode :block} - :frame-options :sameorigin - :content-type-options :nosniff} - :static {:resources "public"} - :responses {:not-modified-responses true - :absolute-redirects true - :content-types true}}} - - :framework.app/web-server {:port 3333 - :join? false}} +{:xiana/postgresql {:image-name "postgres:14-alpine" + :port 5432 + :dbname "controllers" + :host "localhost" + :dbtype "postgresql" + :user "postgres" + :password "postgres"} + + :xiana/web-server {:port 3333 + :join? false}} diff --git a/examples/controllers/docker-compose.yml b/examples/controllers/docker-compose.yml index 4d5af7f7..9952497f 100644 --- a/examples/controllers/docker-compose.yml +++ b/examples/controllers/docker-compose.yml @@ -1,9 +1,11 @@ version: "3.3" services: db: - build: - context: ./Docker - dockerfile: db.Dockerfile + image: postgres:14-alpine + environment: + - POSTGRES_DB=controllers + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=postgres volumes: - db-data:/var/lib/postgresql/data ports: diff --git a/examples/controllers/postgres-start.sh b/examples/controllers/postgres-start.sh deleted file mode 100755 index 540e3d10..00000000 --- a/examples/controllers/postgres-start.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -docker-compose -f docker-compose.yml up --no-start -docker-compose -f docker-compose.yml start \ No newline at end of file diff --git a/examples/controllers/project.clj b/examples/controllers/project.clj index 85d23596..55f707dc 100644 --- a/examples/controllers/project.clj +++ b/examples/controllers/project.clj @@ -2,7 +2,7 @@ :description "FIXME: write description" :min-lein-version "2.0.0" :dependencies [[org.clojure/clojure "1.10.1"] - [com.flexiana/framework "0.3.4"] + [com.flexiana/framework "0.4.0-rc1"] [metosin/reitit "0.5.15"] [metosin/malli "0.6.2"] [duct/server.http.jetty "0.2.1"] diff --git a/examples/frames/Docker/db.Dockerfile b/examples/frames/Docker/db.Dockerfile deleted file mode 100644 index b6d6bc04..00000000 --- a/examples/frames/Docker/db.Dockerfile +++ /dev/null @@ -1,2 +0,0 @@ -FROM postgres:14-alpine -COPY init.sql /docker-entrypoint-initdb.d/ \ No newline at end of file diff --git a/examples/frames/Docker/init.sql b/examples/frames/Docker/init.sql deleted file mode 100644 index 3c09ce68..00000000 --- a/examples/frames/Docker/init.sql +++ /dev/null @@ -1,2 +0,0 @@ -CREATE DATABASE frames; -GRANT ALL PRIVILEGES ON DATABASE frames TO postgres; diff --git a/examples/frames/README.md b/examples/frames/README.md index 01c9db0f..e5dea493 100644 --- a/examples/frames/README.md +++ b/examples/frames/README.md @@ -4,7 +4,7 @@ ### Start dockerized PostgreSQL - postgres-start.sh + docker compose up -d ### Compile front-end and run the application @@ -20,4 +20,4 @@ http://localhost:3000/ http://localhost:3000/status should response -{"status":"OK"} \ No newline at end of file +{"status":"OK"} diff --git a/examples/frames/config/dev/config.edn b/examples/frames/config/dev/config.edn index 0e1a1dd5..46ec83a8 100644 --- a/examples/frames/config/dev/config.edn +++ b/examples/frames/config/dev/config.edn @@ -1,33 +1,15 @@ -{:framework.db.storage/postgresql {:port 5432 - :dbname "frames" - :host "localhost" - :dbtype "postgresql" - :user "postgres" - :password "postgres"} - - :framework.db.storage/migration {:store :database - :migration-dir "resources/migrations" - :init-in-transaction? false - :migration-table-name "migrations"} - - :framework.app/ring {:defaults {:params {:urlencoded true - :multipart true - :nested true - :keywordize true} - :cookies true - :session {:flash true - :cookie-attrs - {:http-only true, :same-site :strict}} - :security {:anti-forgery true - :xss-protection - {:enable? true, :mode :block} - :frame-options :sameorigin - :content-type-options :nosniff} - :static {:resources "public"} - :responses {:not-modified-responses true - :absolute-redirects true - :content-types true}}} - - :framework.app/web-server {:port 3000 - :join? false}} +{:xiana/postgresql {:port 5432 + :dbname "frames" + :host "localhost" + :dbtype "postgresql" + :user "postgres" + :password "postgres"} + + :xiana/migration {:store :database + :migration-dir "resources/migrations" + :init-in-transaction? false + :migration-table-name "migrations"} + + :xiana/web-server {:port 3000 + :join? false}} diff --git a/examples/frames/config/test/config.edn b/examples/frames/config/test/config.edn index 96bab7a3..87b46e85 100644 --- a/examples/frames/config/test/config.edn +++ b/examples/frames/config/test/config.edn @@ -1,3 +1,3 @@ -{:framework.app/web-server {:port 3333 - :join? false}} +{:xiana/web-server {:port 3333 + :join? false}} diff --git a/examples/frames/docker-compose.yml b/examples/frames/docker-compose.yml index 917ba7bb..981b618b 100644 --- a/examples/frames/docker-compose.yml +++ b/examples/frames/docker-compose.yml @@ -1,13 +1,15 @@ version: "3.3" services: db: - build: - context: ./Docker - dockerfile: db.Dockerfile + image: postgres:14-alpine + environment: + - POSTGRES_DB=frames + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=postgres volumes: - db-data:/var/lib/postgresql/data ports: - "5432:5432" volumes: - db-data: \ No newline at end of file + db-data: diff --git a/examples/frames/postgres-start.sh b/examples/frames/postgres-start.sh deleted file mode 100755 index 540e3d10..00000000 --- a/examples/frames/postgres-start.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -docker-compose -f docker-compose.yml up --no-start -docker-compose -f docker-compose.yml start \ No newline at end of file diff --git a/examples/frames/project.clj b/examples/frames/project.clj index 2d268243..afb432ca 100644 --- a/examples/frames/project.clj +++ b/examples/frames/project.clj @@ -2,7 +2,7 @@ :description "FIXME: write description" :min-lein-version "2.0.0" :dependencies [[org.clojure/clojure "1.10.1"] - [com.flexiana/framework "0.3.4"] + [com.flexiana/framework "0.4.0-rc1"] [com.flexiana/corpus "0.1.3"] [thheller/shadow-cljs "2.11.7"] [reagent "0.10.0"] diff --git a/examples/sessions/config/dev/config.edn b/examples/sessions/config/dev/config.edn index 119c15bb..3ab57cbd 100644 --- a/examples/sessions/config/dev/config.edn +++ b/examples/sessions/config/dev/config.edn @@ -1,11 +1,11 @@ -{:framework.app/session-backend {:storage :database - :session-table-name :sessions - :port 5432 - :dbname "sessions" - :host "localhost" - :dbtype "postgresql" - :user "sessions" - :password "postgres"} - :framework.app/web-server {:port 3000 - :join? false}} +{:xiana/session-backend {:storage :database + :session-table-name :sessions + :port 5432 + :dbname "sessions" + :host "localhost" + :dbtype "postgresql" + :user "sessions" + :password "postgres"} + :xiana/web-server {:port 3000 + :join? false}} diff --git a/examples/sessions/config/test/config.edn b/examples/sessions/config/test/config.edn index 6408263d..b6d5dced 100644 --- a/examples/sessions/config/test/config.edn +++ b/examples/sessions/config/test/config.edn @@ -1,10 +1,10 @@ -{:framework.app/session-backend {:storage :database - :session-table-name :sessions - :port 5432 - :dbname "sessions" - :host "localhost" - :dbtype "postgresql" - :user "sessions" - :password "postgres"} - :framework.app/web-server {:port 3333 - :join? false}} +{:xiana/session-backend {:storage :database + :session-table-name :sessions + :port 5432 + :dbname "sessions" + :host "localhost" + :dbtype "postgresql" + :user "sessions" + :password "postgres"} + :xiana/web-server {:port 3333 + :join? false}} diff --git a/examples/sessions/project.clj b/examples/sessions/project.clj index 18a268fa..57149e8c 100644 --- a/examples/sessions/project.clj +++ b/examples/sessions/project.clj @@ -2,7 +2,7 @@ :description "FIXME: write description" :min-lein-version "2.0.0" :dependencies [[org.clojure/clojure "1.10.1"] - [com.flexiana/framework "0.3.4"] + [com.flexiana/framework "0.4.0-rc1"] [metosin/reitit "0.5.6"] [duct/server.http.jetty "0.2.1"] [thheller/shadow-cljs "2.11.7"] diff --git a/examples/sessions/shadow-cljs.edn b/examples/sessions/shadow-cljs.edn index dd140f97..f1fb20a2 100644 --- a/examples/sessions/shadow-cljs.edn +++ b/examples/sessions/shadow-cljs.edn @@ -1,26 +1,26 @@ - ;; - ;; >>>>>>>>>>>>>>>>>>>>>>>>>> DO NOT EDIT THIS FILE <<<<<<<<<<<<<<<<<<<<<<<<<<< - ;; - ;; - ;; - ;; - ;; - ;; - ;; This file is generated by lein-shadow. - ;; Any changes you make will be overwritten and lost. - ;; Instead you should edit the value keyed :shadow-cljs in project.clj. - ;; - ;; More details: https://gitlab.com/nikperic/lein-shadow/-/tree/docs/shadow-cljs.edn.md - ;; - ;; Don't even check this file into your git repo. Add it to .gitignore. - ;; - ;; - ;; - ;; - ;; - ;; - ;; - ;; >>>>>>>>>>>>>>>>>>>>>>>> YOUR CHANGES WILL BE LOST <<<<<<<<<<<<<<<<<<<<<<<<< - ;; - {:nrepl {:port 8777}, :builds {:app {:target :browser, :output-dir "resources/public/js/compiled", :asset-path "/js/compiled", :modules {:app {:init-fn controllers.core/init, :preloads [devtools.preload]}}}}, :lein true} \ No newline at end of file +;; +;; >>>>>>>>>>>>>>>>>>>>>>>>>> DO NOT EDIT THIS FILE <<<<<<<<<<<<<<<<<<<<<<<<<<< +;; +;; +;; +;; +;; +;; +;; This file is generated by lein-shadow. +;; Any changes you make will be overwritten and lost. +;; Instead you should edit the value keyed :shadow-cljs in project.clj. +;; +;; More details: https://gitlab.com/nikperic/lein-shadow/-/tree/docs/shadow-cljs.edn.md +;; +;; Don't even check this file into your git repo. Add it to .gitignore. +;; +;; +;; +;; +;; +;; +;; +;; >>>>>>>>>>>>>>>>>>>>>>>> YOUR CHANGES WILL BE LOST <<<<<<<<<<<<<<<<<<<<<<<<< +;; +{:nrepl {:port 8777}, :builds {:app {:target :browser, :output-dir "resources/public/js/compiled", :asset-path "/js/compiled", :modules {:app {:init-fn controllers.core/init, :preloads [devtools.preload]}}}}, :lein true} diff --git a/examples/sessions/test/integration.clj b/examples/sessions/test/integration.clj index 4a61171a..bba9f6e0 100644 --- a/examples/sessions/test/integration.clj +++ b/examples/sessions/test/integration.clj @@ -14,15 +14,15 @@ (defn merge-connection [config] - (assoc config :framework.app/session-backend - (commons/deep-merge (:framework.app/session-backend config) - (:framework.db.storage/postgresql config)))) + (assoc config :xiana/session-backend + (commons/deep-merge (:xiana/session-backend config) + (:xiana/postgresql config)))) (defn std-system-fixture [f] (with-open [system (-> (config/config app/app-cfg) - (assoc :framework.db.storage/postgresql (:framework.app/session-backend (config/config))) - (assoc-in [:framework.db.storage/postgresql :image-name] "postgres:14-alpine") + (assoc :xiana/postgresql (:xiana/session-backend (config/config))) + (assoc-in [:xiana/postgresql :image-name] "postgres:14-alpine") db/docker-postgres! db/connect merge-connection diff --git a/examples/state-events/config/dev/config.edn b/examples/state-events/config/dev/config.edn index fe80b43a..5541238c 100644 --- a/examples/state-events/config/dev/config.edn +++ b/examples/state-events/config/dev/config.edn @@ -1,40 +1,22 @@ -{:framework.db.storage/postgresql {:port 5433 - :dbname "state_events" - :host "localhost" - :dbtype "postgresql" - :user "postgres" - :password "postgres"} +{:xiana/postgresql {:port 5433 + :dbname "state_events" + :host "localhost" + :dbtype "postgresql" + :user "postgres" + :password "postgres"} - :framework.db.storage/migration {:store :database - :migration-dir "migrations" - :init-in-transaction? false - :migration-table-name "migrations"} + :xiana/migration {:store :database + :migration-dir "migrations" + :init-in-transaction? false + :migration-table-name "migrations"} - :framework.app/ring {:defaults {:params {:urlencoded true - :multipart true - :nested true - :keywordize true} - :cookies true - :session {:flash true - :cookie-attrs - {:http-only true, :same-site :strict}} - :security {:anti-forgery true - :xss-protection - {:enable? true, :mode :block} - :frame-options :sameorigin - :content-type-options :nosniff} - :static {:resources "public"} - :responses {:not-modified-responses true - :absolute-redirects true - :content-types true}}} + :xiana/web-server {:port 3000 + :join? false} - :framework.app/web-server {:port 3000 - :join? false} - - :framework.app/auth {:hash-algorithm :bcrypt ;; Available values: :bcrypt, :scrypt, and :pbkdf2 - :bcrypt-settings {:work-factor 11} - :scrypt-settings {:cpu-cost 32768 ;; Must be a power of 2 - :memory-cost 8 - :parallelization 1} - :pbkdf2-settings {:type :sha1 ;; Available values: :sha1 and :sha256 - :iterations 100000}}} + :xiana/auth {:hash-algorithm :bcrypt ; Available values: :bcrypt, :scrypt, and :pbkdf2 + :bcrypt-settings {:work-factor 11} + :scrypt-settings {:cpu-cost 32768 ; Must be a power of 2 + :memory-cost 8 + :parallelization 1} + :pbkdf2-settings {:type :sha1 ; Available values: :sha1 and :sha256 + :iterations 100000}}} diff --git a/examples/state-events/config/test/config.edn b/examples/state-events/config/test/config.edn index 4b394076..b45c40ae 100644 --- a/examples/state-events/config/test/config.edn +++ b/examples/state-events/config/test/config.edn @@ -1,42 +1,24 @@ -{:framework.db.storage/postgresql {:image-name "postgres:11.5-alpine" - :port 5433 - :dbname "state_events" - :host "localhost" - :dbtype "postgresql" - :user "postgres" - :password "postgres"} +{:xiana/postgresql {:image-name "postgres:11.5-alpine" + :port 5433 + :dbname "state_events" + :host "localhost" + :dbtype "postgresql" + :user "postgres" + :password "postgres"} - :framework.db.storage/migration {:store :database - :migration-dir "migrations" - :init-in-transaction? false - :migration-table-name "migrations"} + :xiana/migration {:store :database + :migration-dir "migrations" + :init-in-transaction? false + :migration-table-name "migrations"} - :framework.app/ring {:defaults {:params {:urlencoded true - :multipart true - :nested true - :keywordize true} - :cookies true - :session {:flash true - :cookie-attrs - {:http-only true, :same-site :strict}} - :security {:anti-forgery true - :xss-protection - {:enable? true, :mode :block} - :frame-options :sameorigin - :content-type-options :nosniff} - :static {:resources "public"} - :responses {:not-modified-responses true - :absolute-redirects true - :content-types true}}} + :xiana/web-server {:port 3333 + :join? false} - :framework.app/web-server {:port 3333 - :join? false} - - :framework.app/auth {:hash-algorithm :bcrypt ;; Available values: :bcrypt, :scrypt, and :pbkdf2 - :bcrypt-settings {:work-factor 11} - :scrypt-settings {:cpu-cost 32768 ;; Must be a power of 2 - :memory-cost 8 - :parallelization 1} - :pbkdf2-settings {:type :sha1 ;; Available values: :sha1 and :sha256 - :iterations 100000}}} + :xiana/auth {:hash-algorithm :bcrypt ; Available values: :bcrypt, :scrypt, and :pbkdf2 + :bcrypt-settings {:work-factor 11} + :scrypt-settings {:cpu-cost 32768 ; Must be a power of 2 + :memory-cost 8 + :parallelization 1} + :pbkdf2-settings {:type :sha1 ; Available values: :sha1 and :sha256 + :iterations 100000}}} diff --git a/examples/state-events/project.clj b/examples/state-events/project.clj index 96f98684..ee65c1c9 100644 --- a/examples/state-events/project.clj +++ b/examples/state-events/project.clj @@ -2,7 +2,7 @@ :description "FIXME: write description" :min-lein-version "2.0.0" :dependencies [[org.clojure/clojure "1.10.3"] - [com.flexiana/framework "0.3.4"] + [com.flexiana/framework "0.4.0-rc1"] [thheller/shadow-cljs "2.11.26"] [cljs-ajax "0.8.4"] [org.clojure/tools.namespace "1.1.0"] diff --git a/examples/state-events/src/backend/state_events/core.clj b/examples/state-events/src/backend/state_events/core.clj index 3ec19d2f..cc5c5a4f 100644 --- a/examples/state-events/src/backend/state_events/core.clj +++ b/examples/state-events/src/backend/state_events/core.clj @@ -65,14 +65,14 @@ (defn docker? [state] - (if (get-in state [:framework.db.storage/postgresql :image-name]) + (if (get-in state [:xiana/postgresql :image-name]) (db/docker-postgres! state) state)) (defn ->system [app-cfg] (-> (config/config app-cfg) - (rename-key :framework.app/auth :auth) + (rename-key :xiana/auth :auth) routes/reset rbac/init session/init-backend diff --git a/project.clj b/project.clj index fb4cf6d1..7918f7e9 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject com.flexiana/framework "0.3.4" +(defproject com.flexiana/framework "0.4.0-rc1" :description "Framework" :url "https://github.com/Flexiana/framework" :license {:name "FIXME" :url "FIXME"} @@ -29,7 +29,7 @@ [piotr-yuxuan/closeable-map "0.35.0"] [potemkin "0.4.5"] [seancorfield/next.jdbc "1.2.659"] - [yogthos/config "1.1.7"]] + [yogthos/config "1.1.9"]] :source-paths ["src"] :target "target/%s/" :profiles {:dev {:resource-paths ["config/dev"]} diff --git a/src/framework/db/core.clj b/src/framework/db/core.clj index 23a88059..be745c08 100644 --- a/src/framework/db/core.clj +++ b/src/framework/db/core.clj @@ -33,9 +33,9 @@ (get-datasource config 0)) ([config count] (let [jdbc-opts (merge default-opts - (:framework.db.storage/jdbc-opts config))] + (:xiana/jdbc-opts config))] (try (-> config - :framework.db.storage/postgresql + :xiana/postgresql jdbc/get-datasource (jdbc/with-options jdbc-opts)) (catch Exception e (if (< count 10) @@ -43,7 +43,7 @@ (throw e))))))) (defn docker-postgres! - [{pg-config :framework.db.storage/postgresql :as config}] + [{pg-config :xiana/postgresql :as config}] (let [{:keys [dbname user password image-name]} pg-config container (-> (tc/create {:image-name image-name @@ -60,17 +60,17 @@ :subname (str "//localhost:" port "/" dbname))] (tc/wait {:wait-strategy :log :message "accept connections"} (:container container)) - (assoc config :framework.db.storage/postgresql pg-config))) + (assoc config :xiana/postgresql pg-config))) (defn migrate! ([config] (migrate! config 0)) ([config count] (try (let [db-conf {:datasource (-> config - :framework.db.storage/postgresql + :xiana/postgresql :datasource jdbc/get-datasource)} - mig-config (assoc (:framework.db.storage/migration config) + mig-config (assoc (:xiana/migration config) :db db-conf)] (migratus/migrate mig-config)) (catch Exception e (if (< count 10) @@ -79,12 +79,12 @@ config)) (defn connect - "Adds `:datasource` key to the `:framework.db.storage/postgresql` config section - and duplicates `:framework.db.storage/postgresql` under the top-level `:db` key." - [{pg-config :framework.db.storage/postgresql :as config}] + "Adds `:datasource` key to the `:xiana/postgresql` config section + and duplicates `:xiana/postgresql` under the top-level `:db` key." + [{pg-config :xiana/postgresql :as config}] (let [pg-config (assoc pg-config :datasource (get-datasource config))] (assoc config - :framework.db.storage/postgresql pg-config + :xiana/postgresql pg-config :db pg-config))) (defn ->sql-params diff --git a/src/framework/db/main.clj b/src/framework/db/main.clj index db9742be..7cd68dd8 100644 --- a/src/framework/db/main.clj +++ b/src/framework/db/main.clj @@ -20,8 +20,8 @@ (let [[command name type] args [_ & ids] args cfg (config/config) - db (:framework.db.storage/postgresql cfg) - config (assoc (:framework.db.storage/migration cfg) :db db)] + db (:xiana/postgresql cfg) + config (assoc (:xiana/migration cfg) :db db)] (log/debug config) (if (str/blank? command) (help) diff --git a/src/framework/db/seed.clj b/src/framework/db/seed.clj index 3b747496..12d15605 100644 --- a/src/framework/db/seed.clj +++ b/src/framework/db/seed.clj @@ -7,11 +7,11 @@ (defn seed! ([config] - (let [db-conf (if-let [datasource (some-> (get-in config [:framework.db.storage/postgresql :datasource]) + (let [db-conf (if-let [datasource (some-> (get-in config [:xiana/postgresql :datasource]) jdbc/get-datasource)] {:datasource datasource} - (:framework.db.storage/postgresql config)) - mig-config (-> (assoc (:framework.db.storage/migration config) :db db-conf) + (:xiana/postgresql config)) + mig-config (-> (assoc (:xiana/migration config) :db db-conf) (rename-key :seeds-dir :migration-dir) (rename-key :seeds-table-name :migration-table-name))] (migratus/migrate mig-config)) @@ -19,8 +19,8 @@ (def seed-config (let [config (config/config) - db-conf (:framework.db.storage/postgresql config)] - (-> (assoc (:framework.db.storage/migration config) :db db-conf) + db-conf (:xiana/postgresql config)] + (-> (assoc (:xiana/migration config) :db db-conf) (rename-key :seeds-dir :migration-dir) (rename-key :seeds-table-name :migration-table-name)))) diff --git a/src/framework/mail/core.clj b/src/framework/mail/core.clj index 8b7d1592..c20ac37e 100644 --- a/src/framework/mail/core.clj +++ b/src/framework/mail/core.clj @@ -16,7 +16,7 @@ (defn send-email! "Sending a mail with 'postal.core'" - [{mail-config :framework.app/emails} + [{mail-config :xiana/emails} {:keys [to cc bcc subject body attachments]}] (pc/send-message mail-config {:from (:from mail-config) diff --git a/src/framework/rbac/core.clj b/src/framework/rbac/core.clj index 9de139a5..ecde4a37 100644 --- a/src/framework/rbac/core.clj +++ b/src/framework/rbac/core.clj @@ -8,7 +8,7 @@ (defn init "Initialize and validates a role-set" [config] - (assoc config :role-set (b/init (:framework.app/role-set config)))) + (assoc config :role-set (b/init (:xiana/role-set config)))) (defn permissions "Gathers the necessary parameters from xiana state for permission resolution. diff --git a/src/framework/session/core.clj b/src/framework/session/core.clj index 11cdb0a3..a0f55532 100644 --- a/src/framework/session/core.clj +++ b/src/framework/session/core.clj @@ -66,19 +66,19 @@ data))) (defn connect - [{backend-config :framework.app/session-backend :as cfg}] - (let [ds-config {:framework.db.storage/postgresql backend-config - :framework.db.storage/jdbc-opts {:builder-fn as-kebab-maps}} + [{backend-config :xiana/session-backend :as cfg}] + (let [ds-config {:xiana/postgresql backend-config + :xiana/jdbc-opts {:builder-fn as-kebab-maps}} connection (cond (every? backend-config [:port :dbname :host :dbtype :user :password]) (db/connect ds-config) (get-in cfg [:db :datasource]) cfg - :else (db/connect {:framework.db.storage/postgresql - (assoc (merge (:framework.db.storage/postgresql cfg) backend-config) - :framework.db.storage/jdbc-opts {:builder-fn as-kebab-maps})}))] + :else (db/connect {:xiana/postgresql + (assoc (merge (:xiana/postgresql cfg) backend-config) + :xiana/jdbc-opts {:builder-fn as-kebab-maps})}))] (get-in connection [:db :datasource]))) (defn- init-in-db "Initialize persistent database session storage." - [{backend-config :framework.app/session-backend :as cfg}] + [{backend-config :xiana/session-backend :as cfg}] (let [ds (connect cfg) table (:session-table-name backend-config :sessions) get-all {:select [:*] @@ -223,7 +223,7 @@ (defn init-backend [{session-backend :session-backend - {storage :storage} :framework.app/session-backend + {storage :storage} :xiana/session-backend :as config}] (cond session-backend config diff --git a/src/framework/webserver/core.clj b/src/framework/webserver/core.clj index c95e38a2..7a39642c 100644 --- a/src/framework/webserver/core.clj +++ b/src/framework/webserver/core.clj @@ -18,7 +18,7 @@ (defn- make "Web server instance." [dependencies] - (let [options (:webserver dependencies (:framework.app/web-server dependencies))] + (let [options (:webserver dependencies (:xiana/web-server dependencies))] (map->webserver {:options options :server (server/run-server (handler-fn dependencies) options)}))) diff --git a/test/framework/config/core_test.clj b/test/framework/config/core_test.clj index 03fabb23..73e1d302 100644 --- a/test/framework/config/core_test.clj +++ b/test/framework/config/core_test.clj @@ -17,32 +17,32 @@ ;; test if the default keys are present (deftest default-keys-are-present (is (every? some? - [(get-in config-map [:framework.app/web-server]) - (get-in config-map [:framework.db.storage/postgresql]) - (get-in config-map [:framework.db.storage/migration]) - (get-in config-map [:framework.app/emails]) - (get-in config-map [:framework.app/auth])]))) + [(get-in config-map [:xiana/web-server]) + (get-in config-map [:xiana/postgresql]) + (get-in config-map [:xiana/migration]) + (get-in config-map [:xiana/emails]) + (get-in config-map [:xiana/auth])]))) ;; test if the web-server map is not empty (deftest web-server-map-not-empty - (let [web-server-map (:framework.app/web-server config-map)] + (let [web-server-map (:xiana/web-server config-map)] (is (= (empty? web-server-map) false)))) ;; test if the web-server map contains the expected keys (:port/:join?) (deftest contain-expected-web-server-map-keys - (let [web-server-map (:framework.app/web-server config-map)] + (let [web-server-map (:xiana/web-server config-map)] (is (not (= (and (map? web-server-map) (:port web-server-map) (:join? web-server-map)) nil))))) (deftest override-with-map - (let [config (config/config {:framework.app/web-server {:port 5000} - :framework.db.storage/postgresql {:user "Nobody"} - :framework.app/emails {:from "xiana@"}})] - (is (= 5000 (get-in config [:framework.app/web-server :port]))) + (let [config (config/config {:xiana/web-server {:port 5000} + :xiana/postgresql {:user "Nobody"} + :xiana/emails {:from "xiana@"}})] + (is (= 5000 (get-in config [:xiana/web-server :port]))) (is (= {:join? false :port 5000} - (get-in config [:framework.app/web-server]))) + (get-in config [:xiana/web-server]))) (is (= {:dbname "framework" :dbtype "postgresql" :host "localhost" @@ -50,6 +50,6 @@ :password "postgres" :port 5432 :user "Nobody"} - (get-in config [:framework.db.storage/postgresql]))) + (get-in config [:xiana/postgresql]))) (is (= {:host "", :user "", :pass "", :tls true, :port 587, :from "xiana@"} - (get-in config [:framework.app/emails]))))) + (get-in config [:xiana/emails]))))) diff --git a/test/framework/rbac/integration_test.clj b/test/framework/rbac/integration_test.clj index 93f755f7..4daddce8 100644 --- a/test/framework/rbac/integration_test.clj +++ b/test/framework/rbac/integration_test.clj @@ -53,7 +53,7 @@ (def system-config {:routes routes :session-backend backend - :framework.app/role-set role-set + :xiana/role-set role-set :controller-interceptors [interceptors/params session/interceptor rbac/interceptor]}) diff --git a/test/framework_fixture.clj b/test/framework_fixture.clj index f6bcf8d0..a5efc493 100644 --- a/test/framework_fixture.clj +++ b/test/framework_fixture.clj @@ -14,7 +14,7 @@ [app-cfg] (-> (config/config) (merge app-cfg) - (rename-key :framework.app/auth :auth) + (rename-key :xiana/auth :auth) session-backend/init-backend db-core/docker-postgres! db-core/connect