diff --git a/README.md b/README.md index e76960b..fe0ca9c 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,25 @@ CREATE USER 'caf'@'%' IDENTIFIED BY 'caf_password'; CREATE DATABASE cafdb CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_bin'; GRANT ALL PRIVILEGES ON cafdb.* TO 'caf'; FLUSH PRIVILEGES; +exit; + +VISUAL="/usr/bin/vi" bin/rails credentials:edit + +production: + database: + username: caf + password: caf_password + + +# database.yml + +production: + <<: *default + database: cafdb + username: <%= Rails.application.credentials.dig(:production, :database, :username) %> + password: <%= Rails.application.credentials.dig(:production, :database, :password) %> + +rails db:migrate ``` Welcome to the Hidden Agenda Ltd CAF tool to help you get organised to become National Cyber Security Centre "Cyber Assessment Framework" (CAF) compliant. diff --git a/config/credentials.yml.enc b/config/credentials.yml.enc index 6464627..a53d2ea 100644 --- a/config/credentials.yml.enc +++ b/config/credentials.yml.enc @@ -1 +1 @@ -0wlK+j+11NIKe85Pfu3w0OdiLVM6fawzZlFSWnvy5fUqRC0A6dVV90yDOfPJh5QEFcvH0Yxe6KcWElZE3ZnYgHWJS9UspLfICs6W+hvNfoUoHW8jyO7fkwcj85RknNrjV+j+XavDFhSRk8wFhQDdLyH4DZrwVRJlCACikuBNcZKvrhe7OvgXvpzKukV4w8lm2MAV0onBSmqBNYv4/24blLb9rIJ17EJVS7TLTccq+fHcQzHT6qZHxRqT/AaRXWaCdoa356j35pmQcwjcaX0gfss9fQVf4zuk7BZqsGrQY7rxgyFsnmdaM6uaK6E8R9tiZjQweJkBOGqlTSZRfEIzdhNwY6FpCZF2xRjOscFOP74Qlbdt5CYNBRMZZM1Dfb3unfeiPj+TOqxKCvYrgqxINwkwe2R8FduyFej4--AYr+gbb69YPkX87U--cM9+bFKTYD1vwbH5k0gnYQ== +WLheIIr1QZTYxze029v8Dy0jL2MB1cvb2ARIh50xWImZ/9LHwFzvUMFIk6ThNBNmnvuXVyRgKtuqwFgTRQSaEQRJrO+5Phi1U0+kvqRPGMet5pE1Pmh89hvhDjc7mHgoSSLCATr3gjP/NDtO7qfv1PKElOko5EOSQYWpamo/O1nHB+NUkLVf1cxgIMBOLRqR58dHdv29s/KKjyuJRlV81mx4eqxxGLEIZie1Luhz6TwMg5VNziO3T/N9T/+WOsBdzWxSWhs2IPFpQ7KrBKp+1OdEoxz+ZDmbBPeEamVdF8cv22LbBBsYuxO/HjRDQHz6/MJv+acjA/YMbGdtGrh63tIurnvek/8n+IXBhBqEgND+YghSCr241atcJFWgIle7r6SC7pxDMEVBhwZ3fdxN8nGN/LUNyH/1I2Z6rSndPwNA5kIo1n6DMgg6tm1KsoWcXzIGlSn4dBp2iJaNrRxNd7bo0XzLn6M/XETceloqxuwvQnj/JbFLFHopmn6Ef7ka05AE+mk1pLLTM7pZkydW7WnkIPpjy81qgktxE3OFe8eZ/xEAGynJ+JSdqxSAXR5xbfxO99rtuALzFl9Nn/FgzA==--APubURaGESknyAqI--/W2j15WLWCyIBgfe9DwLKQ== \ No newline at end of file diff --git a/config/database.yml b/config/database.yml index 35bec07..80d66b0 100644 --- a/config/database.yml +++ b/config/database.yml @@ -14,19 +14,19 @@ default: &default encoding: utf8mb4 pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> username: caf - password: password + password: caf_password host: localhost development: <<: *default - database: caf + database: cafdb # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: <<: *default - database: caf_test + database: cafdb_test # As with config/credentials.yml, you never want to store sensitive information, # like your database password, in your source code. If your source code is @@ -50,6 +50,6 @@ test: # production: <<: *default - database: caf_production - username: caf - password: <%= ENV["CAF_HIDDENAGENDA_LTD_UK_DATABASE_PASSWORD"] %> + database: cafdb + username: <%= Rails.application.credentials.dig(:production, :database, :username) %> + password: <%= Rails.application.credentials.dig(:production, :database, :password) %> diff --git a/db/schema.rb b/db/schema.rb index 076be48..29be00d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,8 +10,8 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema[7.1].define(version: 2024_04_25_091331) do - create_table "action_text_rich_texts", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t| +ActiveRecord::Schema[8.0].define(version: 2024_04_25_091331) do + create_table "action_text_rich_texts", charset: "utf8mb4", collation: "utf8mb4_bin", force: :cascade do |t| t.string "name", null: false t.text "body", size: :long t.string "record_type", null: false @@ -21,7 +21,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_04_25_091331) do t.index ["record_type", "record_id", "name"], name: "index_action_text_rich_texts_uniqueness", unique: true end - create_table "active_storage_attachments", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t| + create_table "active_storage_attachments", charset: "utf8mb4", collation: "utf8mb4_bin", force: :cascade do |t| t.string "name", null: false t.string "record_type", null: false t.bigint "record_id", null: false @@ -31,7 +31,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_04_25_091331) do t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true end - create_table "active_storage_blobs", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t| + create_table "active_storage_blobs", charset: "utf8mb4", collation: "utf8mb4_bin", force: :cascade do |t| t.string "key", null: false t.string "filename", null: false t.string "content_type" @@ -43,13 +43,13 @@ ActiveRecord::Schema[7.1].define(version: 2024_04_25_091331) do t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true end - create_table "active_storage_variant_records", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t| + create_table "active_storage_variant_records", charset: "utf8mb4", collation: "utf8mb4_bin", force: :cascade do |t| t.bigint "blob_id", null: false t.string "variation_digest", null: false t.index ["blob_id", "variation_digest"], name: "index_active_storage_variant_records_uniqueness", unique: true end - create_table "cafs", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t| + create_table "cafs", charset: "utf8mb4", collation: "utf8mb4_bin", force: :cascade do |t| t.bigint "company_id", null: false t.string "name" t.text "description" @@ -58,20 +58,20 @@ ActiveRecord::Schema[7.1].define(version: 2024_04_25_091331) do t.index ["company_id"], name: "index_cafs_on_company_id" end - create_table "companies", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t| + create_table "companies", charset: "utf8mb4", collation: "utf8mb4_bin", force: :cascade do |t| t.string "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false end - create_table "companies_users", id: false, charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t| + create_table "companies_users", id: false, charset: "utf8mb4", collation: "utf8mb4_bin", force: :cascade do |t| t.bigint "user_id" t.bigint "company_id" t.index ["company_id"], name: "index_companies_users_on_company_id" t.index ["user_id"], name: "index_companies_users_on_user_id" end - create_table "objectives", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t| + create_table "objectives", charset: "utf8mb4", collation: "utf8mb4_bin", force: :cascade do |t| t.bigint "caf_id", null: false t.string "name" t.text "description" @@ -80,7 +80,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_04_25_091331) do t.index ["caf_id"], name: "index_objectives_on_caf_id" end - create_table "principles", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t| + create_table "principles", charset: "utf8mb4", collation: "utf8mb4_bin", force: :cascade do |t| t.bigint "objective_id", null: false t.string "name" t.text "description" @@ -90,7 +90,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_04_25_091331) do t.index ["objective_id"], name: "fk_rails_7b57179db6" end - create_table "subprincipleitemgroups", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t| + create_table "subprincipleitemgroups", charset: "utf8mb4", collation: "utf8mb4_bin", force: :cascade do |t| t.bigint "subprinciple_id", null: false t.string "kind" t.datetime "created_at", null: false @@ -99,7 +99,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_04_25_091331) do t.index ["subprinciple_id"], name: "index_subprincipleitemgroups_on_subprinciple_id" end - create_table "subprincipleitems", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t| + create_table "subprincipleitems", charset: "utf8mb4", collation: "utf8mb4_bin", force: :cascade do |t| t.bigint "subprincipleitemgroup_id", null: false t.text "description" t.boolean "affirmative", default: false @@ -108,7 +108,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_04_25_091331) do t.index ["subprincipleitemgroup_id"], name: "index_subprincipleitems_on_subprincipleitemgroup_id" end - create_table "subprinciples", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t| + create_table "subprinciples", charset: "utf8mb4", collation: "utf8mb4_bin", force: :cascade do |t| t.bigint "principle_id", null: false t.string "name" t.text "description" @@ -118,7 +118,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_04_25_091331) do t.index ["principle_id"], name: "index_subprinciples_on_principle_id" end - create_table "users", charset: "utf8mb4", collation: "utf8mb4_general_ci", force: :cascade do |t| + create_table "users", charset: "utf8mb4", collation: "utf8mb4_bin", force: :cascade do |t| t.string "email", default: "", null: false t.string "encrypted_password", default: "", null: false t.string "reset_password_token"