ci: refactor - use cached builds, add tests and lints
This commit is contained in:
parent
c1e39c9bf2
commit
9b0ddf107e
25 changed files with 463 additions and 116 deletions
65
.woodpecker/build.yml
Normal file
65
.woodpecker/build.yml
Normal file
|
@ -0,0 +1,65 @@
|
|||
when:
|
||||
- event: [pull_request, tag]
|
||||
- event: push
|
||||
branch:
|
||||
- ${CI_REPO_DEFAULT_BRANCH}
|
||||
|
||||
variables:
|
||||
- &rust_image 'git.nikos.gg/prymn/images/rust:1794cee2'
|
||||
- &elixir_image 'git.nikos.gg/prymn/images/elixir:1794cee2'
|
||||
- &cache_settings
|
||||
endpoint: https://75178f9eca227dea51b3db4db2c15a5a.r2.cloudflarestorage.com
|
||||
bucket: prymn-cache
|
||||
region: auto
|
||||
access-key:
|
||||
from_secret: R2_CACHE_ACCESS_KEY
|
||||
secret-key:
|
||||
from_secret: R2_CACHE_SECRET_KEY
|
||||
|
||||
steps:
|
||||
restore-elixir-cache:
|
||||
image: meltwater/drone-cache
|
||||
pull: true
|
||||
settings:
|
||||
<<: *cache_settings
|
||||
cache_key: '{{ .Commit.Branch }}-{{ checksum "app/mix.lock" }}'
|
||||
restore: true
|
||||
mount:
|
||||
- 'app/deps'
|
||||
- 'app/_build/dev'
|
||||
|
||||
rust-build:
|
||||
image: *rust_image
|
||||
group: build
|
||||
secrets: [ R2_CACHE_ACCESS_KEY, R2_CACHE_SECRET_KEY ]
|
||||
commands:
|
||||
- export AWS_ACCESS_KEY_ID="$${R2_CACHE_ACCESS_KEY}"
|
||||
- export AWS_SECRET_ACCESS_KEY="$${R2_CACHE_SECRET_KEY}"
|
||||
- cargo check
|
||||
- ls $CARGO_HOME
|
||||
when:
|
||||
- path:
|
||||
- "**/*.rs"
|
||||
- "Cargo.*"
|
||||
|
||||
elixir-build:
|
||||
image: *elixir_image
|
||||
group: build
|
||||
commands:
|
||||
- cd app
|
||||
- mix do deps.get, compile
|
||||
when:
|
||||
- path:
|
||||
- "**/*.{ex,exs}"
|
||||
- "mix.*"
|
||||
|
||||
rebuild-elixir-cache:
|
||||
image: meltwater/drone-cache
|
||||
pull: true
|
||||
settings:
|
||||
<<: *cache_settings
|
||||
cache_key: '{{ .Commit.Branch }}-{{ checksum "app/mix.lock" }}'
|
||||
rebuild: true
|
||||
mount:
|
||||
- 'app/deps'
|
||||
- 'app/_build/dev'
|
76
.woodpecker/lint.yml
Normal file
76
.woodpecker/lint.yml
Normal file
|
@ -0,0 +1,76 @@
|
|||
depends_on:
|
||||
- build
|
||||
- test
|
||||
|
||||
when:
|
||||
- event: [pull_request, tag]
|
||||
- event: push
|
||||
branch:
|
||||
- ${CI_REPO_DEFAULT_BRANCH}
|
||||
|
||||
variables:
|
||||
- &rust_image 'git.nikos.gg/prymn/images/rust:1794cee2'
|
||||
- &elixir_image 'git.nikos.gg/prymn/images/elixir:1794cee2'
|
||||
- &when_elixir
|
||||
- path:
|
||||
- "**/*.{ex,exs}"
|
||||
- "mix.*"
|
||||
- &cache_settings
|
||||
endpoint: https://75178f9eca227dea51b3db4db2c15a5a.r2.cloudflarestorage.com
|
||||
bucket: prymn-cache
|
||||
region: auto
|
||||
access-key:
|
||||
from_secret: R2_CACHE_ACCESS_KEY
|
||||
secret-key:
|
||||
from_secret: R2_CACHE_SECRET_KEY
|
||||
|
||||
steps:
|
||||
restore-elixir-cache:
|
||||
image: meltwater/drone-cache
|
||||
pull: true
|
||||
settings:
|
||||
<<: *cache_settings
|
||||
cache_key: '{{ .Commit.Branch }}-{{ checksum "app/mix.lock" }}'
|
||||
restore: true
|
||||
mount:
|
||||
- 'app/deps'
|
||||
- 'app/_build/dev'
|
||||
|
||||
rust-lint:
|
||||
image: *rust_image
|
||||
group: lint
|
||||
secrets: [ R2_CACHE_ACCESS_KEY, R2_CACHE_SECRET_KEY ]
|
||||
commands:
|
||||
- export AWS_ACCESS_KEY_ID="$${R2_CACHE_ACCESS_KEY}"
|
||||
- export AWS_SECRET_ACCESS_KEY="$${R2_CACHE_SECRET_KEY}"
|
||||
- rustup component add clippy rustfmt
|
||||
- cargo clippy -- -D warnings
|
||||
- cargo fmt --all -- --check
|
||||
when:
|
||||
- path:
|
||||
- "**/*.rs"
|
||||
- "Cargo.*"
|
||||
|
||||
elixir-credo:
|
||||
image: *elixir_image
|
||||
group: lint
|
||||
commands:
|
||||
- cd app
|
||||
- mix credo
|
||||
when: *when_elixir
|
||||
|
||||
elixir-dialyzer:
|
||||
image: *elixir_image
|
||||
group: lint
|
||||
commands:
|
||||
- cd app
|
||||
- mix dialyzer --format short
|
||||
when: *when_elixir
|
||||
|
||||
elixir-format:
|
||||
image: *elixir_image
|
||||
group: lint
|
||||
commands:
|
||||
- cd app
|
||||
- mix format --check-formatted
|
||||
when: *when_elixir
|
|
@ -1,35 +0,0 @@
|
|||
when:
|
||||
- event: tag
|
||||
branch: main
|
||||
|
||||
matrix:
|
||||
BUILD_TARGET:
|
||||
- aarch64-unknown-linux-gnu
|
||||
- x86_64-unknown-linux-gnu
|
||||
|
||||
steps:
|
||||
build:
|
||||
image: git.nikos.gg/prymn/rust/aarch64:latest
|
||||
environment:
|
||||
- RUSTC_WRAPPER=/usr/local/bin/sccache
|
||||
- SCCACHE_BUCKET=prymn-cargo-cache
|
||||
- SCCACHE_ENDPOINT=https://75178f9eca227dea51b3db4db2c15a5a.r2.cloudflarestorage.com
|
||||
- SCCACHE_REGION=auto
|
||||
secrets: [ aws_access_key_id, aws_secret_access_key ]
|
||||
commands:
|
||||
- protoc --version
|
||||
- cargo build --bin prymn_agent --release --target "${BUILD_TARGET}"
|
||||
- mkdir -p "dist/${BUILD_TARGET}"
|
||||
- cp "target/${BUILD_TARGET}/release/prymn_agent" "dist/${BUILD_TARGET}"
|
||||
|
||||
upload:
|
||||
image: woodpeckerci/plugin-s3
|
||||
settings:
|
||||
bucket: prymn-static
|
||||
endpoint: https://75178f9eca227dea51b3db4db2c15a5a.r2.cloudflarestorage.com
|
||||
access_key:
|
||||
from_secret: r2_access_key
|
||||
secret_key:
|
||||
from_secret: r2_secret_key
|
||||
source: dist/**/*
|
||||
target: /agent
|
|
@ -1,38 +0,0 @@
|
|||
labels:
|
||||
platform: linux/arm64
|
||||
|
||||
when:
|
||||
- event: push
|
||||
branch: main
|
||||
|
||||
steps:
|
||||
make-release:
|
||||
image: git.nikos.gg/prymn/images/elixir:61de1c5f
|
||||
environment:
|
||||
- MIX_ENV=prod
|
||||
commands:
|
||||
- cd app && mkdir -p _build
|
||||
### TODO: REMOVE WHEN TAILWIND FROM PHOENIX IS FIXED
|
||||
- curl -sfL https://github.com/tailwindlabs/tailwindcss/releases/download/v3.3.3/tailwindcss-linux-arm64 -o _build/tailwind-linux-arm64
|
||||
- curl -sfL https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.17.11.tgz -o /tmp/esbuild.tgz
|
||||
- tar zxf /tmp/esbuild.tgz -C /tmp
|
||||
- cp /tmp/package/bin/esbuild _build/esbuild-linux-arm64
|
||||
- chmod +x _build/esbuild-linux-arm64
|
||||
- chmod +x _build/tailwind-linux-arm64
|
||||
###
|
||||
- mix deps.get --only prod
|
||||
- mix compile
|
||||
- mix assets.deploy
|
||||
- mix phx.gen.release
|
||||
- mix release
|
||||
|
||||
deploy:
|
||||
image: alpine:latest
|
||||
secrets: [ DEPLOY_KEY, APP_SERVER_ADDRESS ]
|
||||
commands:
|
||||
- apk add --no-cache openssh-client rsync
|
||||
- eval $(ssh-agent -s)
|
||||
- echo "$${DEPLOY_KEY}" | ssh-add -
|
||||
- mkdir -p ~/.ssh && chmod 700 /root/.ssh
|
||||
- ssh-keyscan -t rsa "$${APP_SERVER_ADDRESS}" > /root/.ssh/known_hosts
|
||||
- cd app && rsync -avz --delete _build/prod/rel/prymn/ "prymnci@$${APP_SERVER_ADDRESS}:/srv/app"
|
|
@ -1,17 +0,0 @@
|
|||
when:
|
||||
- event: tag
|
||||
branch: main
|
||||
path: "get_prymn.sh"
|
||||
|
||||
steps:
|
||||
upload:
|
||||
image: woodpeckerci/plugin-s3
|
||||
settings:
|
||||
bucket: prymn-static
|
||||
endpoint: https://75178f9eca227dea51b3db4db2c15a5a.r2.cloudflarestorage.com
|
||||
access_key:
|
||||
from_secret: r2_access_key
|
||||
secret_key:
|
||||
from_secret: r2_secret_key
|
||||
source: "get_prymn.sh"
|
||||
target: "/agent/dist"
|
66
.woodpecker/test.yml
Normal file
66
.woodpecker/test.yml
Normal file
|
@ -0,0 +1,66 @@
|
|||
depends_on:
|
||||
- build
|
||||
|
||||
when:
|
||||
- event: [pull_request, tag]
|
||||
- event: push
|
||||
branch:
|
||||
- ${CI_REPO_DEFAULT_BRANCH}
|
||||
|
||||
services:
|
||||
database:
|
||||
image: postgres
|
||||
environment:
|
||||
- POSTGRES_DB=postgres
|
||||
- POSTGRES_PASSWORD=postgres
|
||||
|
||||
variables:
|
||||
- &rust_image 'git.nikos.gg/prymn/images/rust:1794cee2'
|
||||
- &elixir_image 'git.nikos.gg/prymn/images/elixir:1794cee2'
|
||||
- &cache_settings
|
||||
endpoint: https://75178f9eca227dea51b3db4db2c15a5a.r2.cloudflarestorage.com
|
||||
bucket: prymn-cache
|
||||
region: auto
|
||||
access-key:
|
||||
from_secret: R2_CACHE_ACCESS_KEY
|
||||
secret-key:
|
||||
from_secret: R2_CACHE_SECRET_KEY
|
||||
|
||||
steps:
|
||||
restore-elixir-cache:
|
||||
image: meltwater/drone-cache
|
||||
pull: true
|
||||
settings:
|
||||
<<: *cache_settings
|
||||
cache_key: '{{ .Commit.Branch }}-{{ checksum "app/mix.lock" }}'
|
||||
restore: true
|
||||
mount:
|
||||
- 'app/deps'
|
||||
- 'app/_build/dev'
|
||||
|
||||
rust-test:
|
||||
image: *rust_image
|
||||
group: test
|
||||
secrets: [ R2_CACHE_ACCESS_KEY, R2_CACHE_SECRET_KEY ]
|
||||
commands:
|
||||
- export AWS_ACCESS_KEY_ID="$${R2_CACHE_ACCESS_KEY}"
|
||||
- export AWS_SECRET_ACCESS_KEY="$${R2_CACHE_SECRET_KEY}"
|
||||
- cargo test
|
||||
when:
|
||||
- path:
|
||||
- "**/*.rs"
|
||||
- "Cargo.*"
|
||||
|
||||
elixir-test:
|
||||
image: *elixir_image
|
||||
group: test
|
||||
environment:
|
||||
- MIX_ENV=test
|
||||
- PRYMN_TEST_DATABASE_HOST=database
|
||||
commands:
|
||||
- cd app
|
||||
- mix test
|
||||
when:
|
||||
- path:
|
||||
- "**/*.{ex,exs}"
|
||||
- "mix.*"
|
|
@ -11,14 +11,14 @@ const PRYMN_PATH: &str = "/usr/local/bin/prymn_agent";
|
|||
pub fn install(token: &str) -> anyhow::Result<()> {
|
||||
let this_exe = std::env::current_exe()?;
|
||||
|
||||
copy_binary(&this_exe, &Path::new(PRYMN_PATH)).with_context(|| {
|
||||
copy_binary(&this_exe, Path::new(PRYMN_PATH)).with_context(|| {
|
||||
format!(
|
||||
"could not copy the file {} to the destination {PRYMN_PATH}",
|
||||
this_exe.to_str().unwrap(),
|
||||
)
|
||||
})?;
|
||||
|
||||
install_service_file(&Path::new("/etc/systemd/system/prymn.service"))
|
||||
install_service_file(Path::new("/etc/systemd/system/prymn.service"))
|
||||
.context("could not install the agent daemon service")?;
|
||||
|
||||
register_to_backend(token).context("could not register the agent")?;
|
||||
|
|
188
app/.credo.exs
Normal file
188
app/.credo.exs
Normal file
|
@ -0,0 +1,188 @@
|
|||
%{
|
||||
configs: [
|
||||
%{
|
||||
#
|
||||
# Run any config using `mix credo -C <name>`. If no config name is given
|
||||
# "default" is used.
|
||||
#
|
||||
name: "default",
|
||||
files: %{
|
||||
#
|
||||
# You can give explicit globs or simply directories.
|
||||
# In the latter case `**/*.{ex,exs}` will be used.
|
||||
#
|
||||
included: [
|
||||
"lib/",
|
||||
"src/",
|
||||
"test/",
|
||||
"web/",
|
||||
"apps/*/lib/",
|
||||
"apps/*/src/",
|
||||
"apps/*/test/",
|
||||
"apps/*/web/"
|
||||
],
|
||||
excluded: [~r"/_build/", ~r"/deps/", ~r"/node_modules/"]
|
||||
},
|
||||
plugins: [],
|
||||
requires: [],
|
||||
strict: false,
|
||||
parse_timeout: 5000,
|
||||
color: true,
|
||||
#
|
||||
# You can customize the parameters of any check by adding a second element
|
||||
# to the tuple.
|
||||
#
|
||||
# To disable a check put `false` as second element:
|
||||
#
|
||||
# {Credo.Check.Design.DuplicatedCode, false}
|
||||
#
|
||||
checks: %{
|
||||
enabled: [
|
||||
#
|
||||
## Consistency Checks
|
||||
#
|
||||
{Credo.Check.Consistency.ExceptionNames, []},
|
||||
{Credo.Check.Consistency.LineEndings, []},
|
||||
{Credo.Check.Consistency.ParameterPatternMatching, []},
|
||||
{Credo.Check.Consistency.SpaceAroundOperators, []},
|
||||
{Credo.Check.Consistency.SpaceInParentheses, []},
|
||||
{Credo.Check.Consistency.TabsOrSpaces, []},
|
||||
|
||||
#
|
||||
## Design Checks
|
||||
#
|
||||
# You can customize the priority of any check
|
||||
# Priority values are: `low, normal, high, higher`
|
||||
#
|
||||
{Credo.Check.Design.AliasUsage,
|
||||
[priority: :low, if_nested_deeper_than: 2, if_called_more_often_than: 0]},
|
||||
# You can also customize the exit_status of each check.
|
||||
# If you don't want TODO comments to cause `mix credo` to fail, just
|
||||
# set this value to 0 (zero).
|
||||
#
|
||||
{Credo.Check.Design.TagTODO, [exit_status: 0]},
|
||||
{Credo.Check.Design.TagFIXME, []},
|
||||
|
||||
#
|
||||
## Readability Checks
|
||||
#
|
||||
{Credo.Check.Readability.AliasOrder, []},
|
||||
{Credo.Check.Readability.FunctionNames, []},
|
||||
{Credo.Check.Readability.LargeNumbers, []},
|
||||
{Credo.Check.Readability.MaxLineLength, [priority: :low, max_length: 120]},
|
||||
{Credo.Check.Readability.ModuleAttributeNames, []},
|
||||
{Credo.Check.Readability.ModuleDoc, []},
|
||||
{Credo.Check.Readability.ModuleNames, []},
|
||||
{Credo.Check.Readability.ParenthesesInCondition, []},
|
||||
{Credo.Check.Readability.ParenthesesOnZeroArityDefs, []},
|
||||
{Credo.Check.Readability.PipeIntoAnonymousFunctions, []},
|
||||
{Credo.Check.Readability.PredicateFunctionNames, []},
|
||||
{Credo.Check.Readability.PreferImplicitTry, []},
|
||||
{Credo.Check.Readability.RedundantBlankLines, []},
|
||||
{Credo.Check.Readability.Semicolons, []},
|
||||
{Credo.Check.Readability.SpaceAfterCommas, []},
|
||||
{Credo.Check.Readability.StringSigils, []},
|
||||
{Credo.Check.Readability.TrailingBlankLine, []},
|
||||
{Credo.Check.Readability.TrailingWhiteSpace, []},
|
||||
{Credo.Check.Readability.UnnecessaryAliasExpansion, []},
|
||||
{Credo.Check.Readability.VariableNames, []},
|
||||
{Credo.Check.Readability.WithSingleClause, []},
|
||||
|
||||
#
|
||||
## Refactoring Opportunities
|
||||
#
|
||||
{Credo.Check.Refactor.Apply, []},
|
||||
{Credo.Check.Refactor.CondStatements, []},
|
||||
{Credo.Check.Refactor.CyclomaticComplexity, []},
|
||||
{Credo.Check.Refactor.FunctionArity, []},
|
||||
{Credo.Check.Refactor.LongQuoteBlocks, []},
|
||||
{Credo.Check.Refactor.MatchInCondition, []},
|
||||
{Credo.Check.Refactor.MapJoin, []},
|
||||
{Credo.Check.Refactor.NegatedConditionsInUnless, []},
|
||||
{Credo.Check.Refactor.NegatedConditionsWithElse, []},
|
||||
{Credo.Check.Refactor.Nesting, []},
|
||||
{Credo.Check.Refactor.UnlessWithElse, []},
|
||||
{Credo.Check.Refactor.WithClauses, []},
|
||||
{Credo.Check.Refactor.FilterCount, []},
|
||||
{Credo.Check.Refactor.FilterFilter, []},
|
||||
{Credo.Check.Refactor.RejectReject, []},
|
||||
{Credo.Check.Refactor.RedundantWithClauseResult, []},
|
||||
|
||||
#
|
||||
## Warnings
|
||||
#
|
||||
{Credo.Check.Warning.ApplicationConfigInModuleAttribute, []},
|
||||
{Credo.Check.Warning.BoolOperationOnSameValues, []},
|
||||
{Credo.Check.Warning.Dbg, []},
|
||||
{Credo.Check.Warning.ExpensiveEmptyEnumCheck, []},
|
||||
{Credo.Check.Warning.IExPry, []},
|
||||
{Credo.Check.Warning.IoInspect, []},
|
||||
{Credo.Check.Warning.MissedMetadataKeyInLoggerConfig, []},
|
||||
{Credo.Check.Warning.OperationOnSameValues, []},
|
||||
{Credo.Check.Warning.OperationWithConstantResult, []},
|
||||
{Credo.Check.Warning.RaiseInsideRescue, []},
|
||||
{Credo.Check.Warning.SpecWithStruct, []},
|
||||
{Credo.Check.Warning.WrongTestFileExtension, []},
|
||||
{Credo.Check.Warning.UnusedEnumOperation, []},
|
||||
{Credo.Check.Warning.UnusedFileOperation, []},
|
||||
{Credo.Check.Warning.UnusedKeywordOperation, []},
|
||||
{Credo.Check.Warning.UnusedListOperation, []},
|
||||
{Credo.Check.Warning.UnusedPathOperation, []},
|
||||
{Credo.Check.Warning.UnusedRegexOperation, []},
|
||||
{Credo.Check.Warning.UnusedStringOperation, []},
|
||||
{Credo.Check.Warning.UnusedTupleOperation, []},
|
||||
{Credo.Check.Warning.UnsafeExec, []}
|
||||
],
|
||||
disabled: [
|
||||
#
|
||||
# Checks scheduled for next check update (opt-in for now, just replace `false` with `[]`)
|
||||
|
||||
#
|
||||
# Controversial and experimental checks (opt-in, just move the check to `:enabled`
|
||||
# and be sure to use `mix credo --strict` to see low priority checks)
|
||||
#
|
||||
{Credo.Check.Consistency.MultiAliasImportRequireUse, []},
|
||||
{Credo.Check.Consistency.UnusedVariableNames, []},
|
||||
{Credo.Check.Design.DuplicatedCode, []},
|
||||
{Credo.Check.Design.SkipTestWithoutComment, []},
|
||||
{Credo.Check.Readability.AliasAs, []},
|
||||
{Credo.Check.Readability.BlockPipe, []},
|
||||
{Credo.Check.Readability.ImplTrue, []},
|
||||
{Credo.Check.Readability.MultiAlias, []},
|
||||
{Credo.Check.Readability.NestedFunctionCalls, []},
|
||||
{Credo.Check.Readability.OneArityFunctionInPipe, []},
|
||||
{Credo.Check.Readability.SeparateAliasRequire, []},
|
||||
{Credo.Check.Readability.SingleFunctionToBlockPipe, []},
|
||||
{Credo.Check.Readability.SinglePipe, []},
|
||||
{Credo.Check.Readability.Specs, []},
|
||||
{Credo.Check.Readability.StrictModuleLayout, []},
|
||||
{Credo.Check.Readability.WithCustomTaggedTuple, []},
|
||||
{Credo.Check.Readability.OnePipePerLine, []},
|
||||
{Credo.Check.Refactor.ABCSize, []},
|
||||
{Credo.Check.Refactor.AppendSingleItem, []},
|
||||
{Credo.Check.Refactor.DoubleBooleanNegation, []},
|
||||
{Credo.Check.Refactor.FilterReject, []},
|
||||
{Credo.Check.Refactor.IoPuts, []},
|
||||
{Credo.Check.Refactor.MapMap, []},
|
||||
{Credo.Check.Refactor.ModuleDependencies, []},
|
||||
{Credo.Check.Refactor.NegatedIsNil, []},
|
||||
{Credo.Check.Refactor.PassAsyncInTestCases, []},
|
||||
{Credo.Check.Refactor.PipeChainStart, []},
|
||||
{Credo.Check.Refactor.RejectFilter, []},
|
||||
{Credo.Check.Refactor.VariableRebinding, []},
|
||||
{Credo.Check.Warning.LazyLogging, []},
|
||||
{Credo.Check.Warning.LeakyEnvironment, []},
|
||||
{Credo.Check.Warning.MapGetUnsafePass, []},
|
||||
{Credo.Check.Warning.MixEnv, []},
|
||||
{Credo.Check.Warning.UnsafeToAtom, []}
|
||||
|
||||
# {Credo.Check.Refactor.MapInto, []},
|
||||
|
||||
#
|
||||
# Custom checks can be created using `mix credo.gen.check`.
|
||||
#
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
|
@ -11,7 +11,7 @@ config :argon2_elixir, t_cost: 1, m_cost: 8
|
|||
config :prymn, Prymn.Repo,
|
||||
username: "postgres",
|
||||
password: "postgres",
|
||||
hostname: "localhost",
|
||||
hostname: System.get_env("PRYMN_TEST_DATABASE_HOST") || "127.0.0.1",
|
||||
database: "prymn_test#{System.get_env("MIX_TEST_PARTITION")}",
|
||||
pool: Ecto.Adapters.SQL.Sandbox,
|
||||
pool_size: 10
|
||||
|
|
|
@ -6,7 +6,7 @@ defmodule Prymn.Accounts do
|
|||
import Ecto.Query, warn: false
|
||||
alias Prymn.Repo
|
||||
|
||||
alias Prymn.Accounts.{User, UserToken, UserNotifier}
|
||||
alias Prymn.Accounts.{User, UserNotifier, UserToken}
|
||||
|
||||
## Database getters
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
defmodule Prymn.Accounts.User do
|
||||
@moduledoc false
|
||||
|
||||
import Ecto.Changeset
|
||||
|
||||
use Ecto.Schema
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
defmodule Prymn.Accounts.UserNotifier do
|
||||
@moduledoc """
|
||||
Functions for user mail delivery
|
||||
"""
|
||||
|
||||
import Swoosh.Email
|
||||
|
||||
alias Prymn.Mailer
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
defmodule Prymn.Accounts.UserToken do
|
||||
@moduledoc false
|
||||
|
||||
use Ecto.Schema
|
||||
import Ecto.Query
|
||||
alias Prymn.Accounts.UserToken
|
||||
|
|
|
@ -29,7 +29,7 @@ defmodule Prymn.Agents.Connection do
|
|||
|
||||
# Start a connection without blocking the GenServer
|
||||
Task.start_link(fn ->
|
||||
case GRPC.Stub.connect(host, 50012, []) do
|
||||
case GRPC.Stub.connect(host, 50_012, []) do
|
||||
{:ok, channel} -> send(pid, channel)
|
||||
{:error, error} -> send(pid, {:connect_error, error})
|
||||
end
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
defmodule Prymn.Mailer do
|
||||
@moduledoc false
|
||||
|
||||
use Swoosh.Mailer, otp_app: :prymn
|
||||
end
|
||||
|
|
|
@ -40,7 +40,8 @@ defmodule Prymn.Servers do
|
|||
@doc """
|
||||
Get a single server by its IP.
|
||||
"""
|
||||
@spec get_server_by_ip!(String.t()) :: %Server{}
|
||||
@spec get_server_by_ip!(String.t()) :: Server.t()
|
||||
|
||||
def get_server_by_ip!(ip), do: Repo.get_by!(Server, public_ip: ip)
|
||||
|
||||
@doc """
|
||||
|
@ -125,7 +126,7 @@ defmodule Prymn.Servers do
|
|||
Returns a string containing the command that needs to be executed to the
|
||||
remote server in order to register it to the backend.
|
||||
"""
|
||||
@spec create_setup_command(%Server{}) :: String.t()
|
||||
@spec create_setup_command(Server.t()) :: String.t()
|
||||
def create_setup_command(%Server{registration_token: token}) do
|
||||
token
|
||||
|> Base.encode64()
|
||||
|
|
|
@ -1,7 +1,28 @@
|
|||
defmodule Prymn.Servers.Server do
|
||||
@moduledoc false
|
||||
|
||||
use Ecto.Schema
|
||||
import Ecto.Changeset
|
||||
|
||||
@typedoc """
|
||||
A `Server` describes a server resource that was created in the application.
|
||||
|
||||
Its status can be one of:
|
||||
|
||||
- `:unregistered`: when the resource was just created and the `Prymn Agent`
|
||||
is not yet installed or active.
|
||||
- `:registered`: the Agent was installed, and now the resource MUST have a
|
||||
`public_ip` that we can connect to.
|
||||
"""
|
||||
@type t :: %__MODULE__{
|
||||
id: integer(),
|
||||
name: String.t(),
|
||||
public_ip: String.t(),
|
||||
provider: term(),
|
||||
registration_token: binary(),
|
||||
status: term()
|
||||
}
|
||||
|
||||
schema "servers" do
|
||||
field :name, :string
|
||||
field :public_ip, :string
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
defmodule PrymnWeb.Layouts do
|
||||
@moduledoc false
|
||||
|
||||
use PrymnWeb, :html
|
||||
|
||||
embed_templates "layouts/*"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
defmodule PrymnWeb.ServerLive.Index do
|
||||
require Logger
|
||||
|
||||
alias Prymn.{Servers, Agents}
|
||||
alias Prymn.{Agents, Servers}
|
||||
|
||||
use PrymnWeb, :live_view
|
||||
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
defmodule PrymnWeb.Telemetry do
|
||||
@moduledoc false
|
||||
|
||||
use Supervisor
|
||||
import Telemetry.Metrics
|
||||
|
||||
|
|
|
@ -1,4 +1,8 @@
|
|||
defmodule PrymnWeb.UserAuth do
|
||||
@moduledoc """
|
||||
Functions and callbacks for user authentication, registration, logging out.
|
||||
"""
|
||||
|
||||
import Plug.Conn
|
||||
import Phoenix.Controller
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ defmodule Prymn.MixProject do
|
|||
{:gettext, "~> 0.20"},
|
||||
{:jason, "~> 1.2"},
|
||||
{:plug_cowboy, "~> 2.5"},
|
||||
{:grpc, github: "elixir-grpc/grpc", ref: "691ac2146eac1691e703e31985765f042ec5e91a"},
|
||||
{:grpc, "~> 0.7"},
|
||||
{:protobuf, "~> 0.12.0"},
|
||||
{:google_protos, "~> 0.3.0"},
|
||||
|
||||
|
@ -56,6 +56,7 @@ defmodule Prymn.MixProject do
|
|||
{:floki, ">= 0.30.0", only: :test},
|
||||
|
||||
# Dev
|
||||
{:credo, "~> 1.7", only: [:dev, :test], runtime: false},
|
||||
{:esbuild, "~> 0.7", runtime: Mix.env() == :dev},
|
||||
{:tailwind, "~> 0.2.0", runtime: Mix.env() == :dev},
|
||||
{:tailwind_formatter, "~> 0.3.6", runtime: Mix.env() == :dev},
|
||||
|
|
28
app/mix.lock
28
app/mix.lock
|
@ -1,15 +1,17 @@
|
|||
%{
|
||||
"argon2_elixir": {:hex, :argon2_elixir, "3.1.0", "4135e0a1b4ff800d42c85aa663e068efa3cb356297189b5b65caa992db8ec8cf", [:make, :mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "c08feae0ee0292165d1b945003363c7cd8523d002e0483c627dfca930291dd73"},
|
||||
"argon2_elixir": {:hex, :argon2_elixir, "3.2.1", "f47740bf9f2a39ffef79ba48eb25dea2ee37bcc7eadf91d49615591d1a6fce1a", [:make, :mix], [{:comeonin, "~> 5.3", [hex: :comeonin, repo: "hexpm", optional: false]}, {:elixir_make, "~> 0.6", [hex: :elixir_make, repo: "hexpm", optional: false]}], "hexpm", "a813b78217394530b5fcf4c8070feee43df03ffef938d044019169c766315690"},
|
||||
"bunt": {:hex, :bunt, "0.2.1", "e2d4792f7bc0ced7583ab54922808919518d0e57ee162901a16a1b6664ef3b14", [:mix], [], "hexpm", "a330bfb4245239787b15005e66ae6845c9cd524a288f0d141c148b02603777a5"},
|
||||
"castore": {:hex, :castore, "1.0.3", "7130ba6d24c8424014194676d608cb989f62ef8039efd50ff4b3f33286d06db8", [:mix], [], "hexpm", "680ab01ef5d15b161ed6a95449fac5c6b8f60055677a8e79acf01b27baa4390b"},
|
||||
"comeonin": {:hex, :comeonin, "5.3.3", "2c564dac95a35650e9b6acfe6d2952083d8a08e4a89b93a481acb552b325892e", [:mix], [], "hexpm", "3e38c9c2cb080828116597ca8807bb482618a315bfafd98c90bc22a821cc84df"},
|
||||
"comeonin": {:hex, :comeonin, "5.4.0", "246a56ca3f41d404380fc6465650ddaa532c7f98be4bda1b4656b3a37cc13abe", [:mix], [], "hexpm", "796393a9e50d01999d56b7b8420ab0481a7538d0caf80919da493b4a6e51faf1"},
|
||||
"cowboy": {:hex, :cowboy, "2.10.0", "ff9ffeff91dae4ae270dd975642997afe2a1179d94b1887863e43f681a203e26", [:make, :rebar3], [{:cowlib, "2.12.1", [hex: :cowlib, repo: "hexpm", optional: false]}, {:ranch, "1.8.0", [hex: :ranch, repo: "hexpm", optional: false]}], "hexpm", "3afdccb7183cc6f143cb14d3cf51fa00e53db9ec80cdcd525482f5e99bc41d6b"},
|
||||
"cowboy_telemetry": {:hex, :cowboy_telemetry, "0.4.0", "f239f68b588efa7707abce16a84d0d2acf3a0f50571f8bb7f56a15865aae820c", [:rebar3], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7d98bac1ee4565d31b62d59f8823dfd8356a169e7fcbb83831b8a5397404c9de"},
|
||||
"cowlib": {:hex, :cowlib, "2.12.1", "a9fa9a625f1d2025fe6b462cb865881329b5caff8f1854d1cbc9f9533f00e1e1", [:make, :rebar3], [], "hexpm", "163b73f6367a7341b33c794c4e88e7dbfe6498ac42dcd69ef44c5bc5507c8db0"},
|
||||
"credo": {:hex, :credo, "1.7.0", "6119bee47272e85995598ee04f2ebbed3e947678dee048d10b5feca139435f75", [:mix], [{:bunt, "~> 0.2.1", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "6839fcf63d1f0d1c0f450abc8564a57c43d644077ab96f2934563e68b8a769d7"},
|
||||
"db_connection": {:hex, :db_connection, "2.5.0", "bb6d4f30d35ded97b29fe80d8bd6f928a1912ca1ff110831edcd238a1973652c", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "c92d5ba26cd69ead1ff7582dbb860adeedfff39774105a4f1c92cbb654b55aa2"},
|
||||
"decimal": {:hex, :decimal, "2.1.1", "5611dca5d4b2c3dd497dec8f68751f1f1a54755e8ed2a966c2633cf885973ad6", [:mix], [], "hexpm", "53cfe5f497ed0e7771ae1a475575603d77425099ba5faef9394932b35020ffcc"},
|
||||
"dialyxir": {:hex, :dialyxir, "1.4.0", "6b698401c16de79e8596b73dca63762255e70e4bbe26423530e173917220d5fc", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "c7ecaa1da27debae488ab09d9827ec58a0161c7821972b6d2cb26c1614648849"},
|
||||
"dialyxir": {:hex, :dialyxir, "1.4.1", "a22ed1e7bd3a3e3f197b68d806ef66acb61ee8f57b3ac85fc5d57354c5482a93", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "84b795d6d7796297cca5a3118444b80c7d94f7ce247d49886e7c291e1ae49801"},
|
||||
"ecto": {:hex, :ecto, "3.10.3", "eb2ae2eecd210b4eb8bece1217b297ad4ff824b4384c0e3fdd28aaf96edd6135", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "44bec74e2364d491d70f7e42cd0d690922659d329f6465e89feb8a34e8cd3433"},
|
||||
"ecto_sql": {:hex, :ecto_sql, "3.10.1", "6ea6b3036a0b0ca94c2a02613fd9f742614b5cfe494c41af2e6571bb034dd94c", [:mix], [{:db_connection, "~> 2.4.1 or ~> 2.5", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.10.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.6.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.16.0 or ~> 0.17.0 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1 or ~> 2.2", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "f6a25bdbbd695f12c8171eaff0851fa4c8e72eec1e98c7364402dda9ce11c56b"},
|
||||
"ecto_sql": {:hex, :ecto_sql, "3.10.2", "6b98b46534b5c2f8b8b5f03f126e75e2a73c64f3c071149d32987a5378b0fdbd", [:mix], [{:db_connection, "~> 2.4.1 or ~> 2.5", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.10.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.6.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.16.0 or ~> 0.17.0 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1 or ~> 2.2", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "68c018debca57cb9235e3889affdaec7a10616a4e3a80c99fa1d01fdafaa9007"},
|
||||
"elixir_make": {:hex, :elixir_make, "0.7.7", "7128c60c2476019ed978210c245badf08b03dbec4f24d05790ef791da11aa17c", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}], "hexpm", "5bc19fff950fad52bbe5f211b12db9ec82c6b34a9647da0c2224b8b8464c7e6c"},
|
||||
"erlex": {:hex, :erlex, "0.2.6", "c7987d15e899c7a2f34f5420d2a2ea0d659682c06ac607572df55a43753aa12e", [:mix], [], "hexpm", "2ed2e25711feb44d52b17d2780eabf998452f6efda104877a3881c2f8c0c0c75"},
|
||||
"esbuild": {:hex, :esbuild, "0.7.1", "fa0947e8c3c3c2f86c9bf7e791a0a385007ccd42b86885e8e893bdb6631f5169", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}], "hexpm", "66661cdf70b1378ee4dc16573fcee67750b59761b2605a0207c267ab9d19f13c"},
|
||||
|
@ -17,9 +19,9 @@
|
|||
"file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"},
|
||||
"finch": {:hex, :finch, "0.16.0", "40733f02c89f94a112518071c0a91fe86069560f5dbdb39f9150042f44dcfb1a", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: false]}, {:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 1.3", [hex: :mint, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.4 or ~> 1.0", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:nimble_pool, "~> 0.2.6 or ~> 1.0", [hex: :nimble_pool, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "f660174c4d519e5fec629016054d60edd822cdfe2b7270836739ac2f97735ec5"},
|
||||
"floki": {:hex, :floki, "0.34.3", "5e2dcaec5d7c228ce5b1d3501502e308b2d79eb655e4191751a1fe491c37feac", [:mix], [], "hexpm", "9577440eea5b97924b4bf3c7ea55f7b8b6dce589f9b28b096cc294a8dc342341"},
|
||||
"gettext": {:hex, :gettext, "0.22.3", "c8273e78db4a0bb6fba7e9f0fd881112f349a3117f7f7c598fa18c66c888e524", [:mix], [{:expo, "~> 0.4.0", [hex: :expo, repo: "hexpm", optional: false]}], "hexpm", "935f23447713954a6866f1bb28c3a878c4c011e802bcd68a726f5e558e4b64bd"},
|
||||
"gettext": {:hex, :gettext, "0.23.1", "821e619a240e6000db2fc16a574ef68b3bd7fe0167ccc264a81563cc93e67a31", [:mix], [{:expo, "~> 0.4.0", [hex: :expo, repo: "hexpm", optional: false]}], "hexpm", "19d744a36b809d810d610b57c27b934425859d158ebd56561bc41f7eeb8795db"},
|
||||
"google_protos": {:hex, :google_protos, "0.3.0", "15faf44dce678ac028c289668ff56548806e313e4959a3aaf4f6e1ebe8db83f4", [:mix], [{:protobuf, "~> 0.10", [hex: :protobuf, repo: "hexpm", optional: false]}], "hexpm", "1f6b7fb20371f72f418b98e5e48dae3e022a9a6de1858d4b254ac5a5d0b4035f"},
|
||||
"grpc": {:git, "https://github.com/elixir-grpc/grpc.git", "691ac2146eac1691e703e31985765f042ec5e91a", [ref: "691ac2146eac1691e703e31985765f042ec5e91a"]},
|
||||
"grpc": {:hex, :grpc, "0.7.0", "a86eab356b0b84406b526786a947ca50e9b9eae87108c873b51e321f8a71e8ed", [:mix], [{:cowboy, "~> 2.10", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowlib, "~> 2.12", [hex: :cowlib, repo: "hexpm", optional: false]}, {:gun, "~> 2.0", [hex: :gun, repo: "hexpm", optional: false]}, {:mint, "~> 1.5", [hex: :mint, repo: "hexpm", optional: false]}, {:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "632a9507da8d3c12b112b197db4d60da3c95bad02594d37711eeb622d032f254"},
|
||||
"gun": {:hex, :gun, "2.0.1", "160a9a5394800fcba41bc7e6d421295cf9a7894c2252c0678244948e3336ad73", [:make, :rebar3], [{:cowlib, "2.12.1", [hex: :cowlib, repo: "hexpm", optional: false]}], "hexpm", "a10bc8d6096b9502205022334f719cc9a08d9adcfbfc0dbee9ef31b56274a20b"},
|
||||
"hpax": {:hex, :hpax, "0.1.2", "09a75600d9d8bbd064cdd741f21fc06fc1f4cf3d0fcc335e5aa19be1a7235c84", [:mix], [], "hexpm", "2c87843d5a23f5f16748ebe77969880e29809580efdaccd615cd3bed628a8c13"},
|
||||
"jason": {:hex, :jason, "1.4.1", "af1504e35f629ddcdd6addb3513c3853991f694921b1b9368b0bd32beb9f1b63", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "fbb01ecdfd565b56261302f7e1fcc27c4fb8f32d56eab74db621fc154604a7a1"},
|
||||
|
@ -29,8 +31,8 @@
|
|||
"nimble_pool": {:hex, :nimble_pool, "1.0.0", "5eb82705d138f4dd4423f69ceb19ac667b3b492ae570c9f5c900bb3d2f50a847", [:mix], [], "hexpm", "80be3b882d2d351882256087078e1b1952a28bf98d0a287be87e4a24a710b67a"},
|
||||
"phoenix": {:hex, :phoenix, "1.7.7", "4cc501d4d823015007ba3cdd9c41ecaaf2ffb619d6fb283199fa8ddba89191e0", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.6", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:websock_adapter, "~> 0.5.3", [hex: :websock_adapter, repo: "hexpm", optional: false]}], "hexpm", "8966e15c395e5e37591b6ed0bd2ae7f48e961f0f60ac4c733f9566b519453085"},
|
||||
"phoenix_ecto": {:hex, :phoenix_ecto, "4.4.2", "b21bd01fdeffcfe2fab49e4942aa938b6d3e89e93a480d4aee58085560a0bc0d", [:mix], [{:ecto, "~> 3.5", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.9", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "70242edd4601d50b69273b057ecf7b684644c19ee750989fd555625ae4ce8f5d"},
|
||||
"phoenix_html": {:hex, :phoenix_html, "3.3.1", "4788757e804a30baac6b3fc9695bf5562465dd3f1da8eb8460ad5b404d9a2178", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "bed1906edd4906a15fd7b412b85b05e521e1f67c9a85418c55999277e553d0d3"},
|
||||
"phoenix_live_dashboard": {:hex, :phoenix_live_dashboard, "0.8.0", "0b3158b5b198aa444473c91d23d79f52fb077e807ffad80dacf88ce078fa8df2", [:mix], [{:ecto, "~> 3.6.2 or ~> 3.7", [hex: :ecto, repo: "hexpm", optional: true]}, {:ecto_mysql_extras, "~> 0.5", [hex: :ecto_mysql_extras, repo: "hexpm", optional: true]}, {:ecto_psql_extras, "~> 0.7", [hex: :ecto_psql_extras, repo: "hexpm", optional: true]}, {:ecto_sqlite3_extras, "~> 1.1.7", [hex: :ecto_sqlite3_extras, repo: "hexpm", optional: true]}, {:mime, "~> 1.6 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.19.0", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}, {:telemetry_metrics, "~> 0.6 or ~> 1.0", [hex: :telemetry_metrics, repo: "hexpm", optional: false]}], "hexpm", "87785a54474fed91a67a1227a741097eb1a42c2e49d3c0d098b588af65cd410d"},
|
||||
"phoenix_html": {:hex, :phoenix_html, "3.3.2", "d6ce982c6d8247d2fc0defe625255c721fb8d5f1942c5ac051f6177bffa5973f", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "44adaf8e667c1c20fb9d284b6b0fa8dc7946ce29e81ce621860aa7e96de9a11d"},
|
||||
"phoenix_live_dashboard": {:hex, :phoenix_live_dashboard, "0.8.1", "c4f2a2d3b26e6ca684d162ccf18aaeed8bed2181896e0393d0a2959789482e51", [:mix], [{:ecto, "~> 3.6.2 or ~> 3.7", [hex: :ecto, repo: "hexpm", optional: true]}, {:ecto_mysql_extras, "~> 0.5", [hex: :ecto_mysql_extras, repo: "hexpm", optional: true]}, {:ecto_psql_extras, "~> 0.7", [hex: :ecto_psql_extras, repo: "hexpm", optional: true]}, {:ecto_sqlite3_extras, "~> 1.1.7 or ~> 1.2.0", [hex: :ecto_sqlite3_extras, repo: "hexpm", optional: true]}, {:mime, "~> 1.6 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.19.0", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}, {:telemetry_metrics, "~> 0.6 or ~> 1.0", [hex: :telemetry_metrics, repo: "hexpm", optional: false]}], "hexpm", "1ca0f954274ce1916f771f86b3d49a91d3447e7c32d171660676095c5f30abe9"},
|
||||
"phoenix_live_reload": {:hex, :phoenix_live_reload, "1.4.1", "2aff698f5e47369decde4357ba91fc9c37c6487a512b41732818f2204a8ef1d3", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.4", [hex: :phoenix, repo: "hexpm", optional: false]}], "hexpm", "9bffb834e7ddf08467fe54ae58b5785507aaba6255568ae22b4d46e2bb3615ab"},
|
||||
"phoenix_live_view": {:hex, :phoenix_live_view, "0.19.5", "6e730595e8e9b8c5da230a814e557768828fd8dfeeb90377d2d8dbb52d4ec00a", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.6.15 or ~> 1.7.0", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 3.3", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "b2eaa0dd3cfb9bd7fb949b88217df9f25aed915e986a28ad5c8a0d054e7ca9d3"},
|
||||
"phoenix_pubsub": {:hex, :phoenix_pubsub, "2.1.3", "3168d78ba41835aecad272d5e8cd51aa87a7ac9eb836eabc42f6e57538e3731d", [:mix], [], "hexpm", "bba06bc1dcfd8cb086759f0edc94a8ba2bc8896d5331a1e2c2902bf8e36ee502"},
|
||||
|
@ -38,15 +40,15 @@
|
|||
"plug": {:hex, :plug, "1.14.2", "cff7d4ec45b4ae176a227acd94a7ab536d9b37b942c8e8fa6dfc0fff98ff4d80", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "842fc50187e13cf4ac3b253d47d9474ed6c296a8732752835ce4a86acdf68d13"},
|
||||
"plug_cowboy": {:hex, :plug_cowboy, "2.6.1", "9a3bbfceeb65eff5f39dab529e5cd79137ac36e913c02067dba3963a26efe9b2", [:mix], [{:cowboy, "~> 2.7", [hex: :cowboy, repo: "hexpm", optional: false]}, {:cowboy_telemetry, "~> 0.3", [hex: :cowboy_telemetry, repo: "hexpm", optional: false]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "de36e1a21f451a18b790f37765db198075c25875c64834bcc82d90b309eb6613"},
|
||||
"plug_crypto": {:hex, :plug_crypto, "1.2.5", "918772575e48e81e455818229bf719d4ab4181fcbf7f85b68a35620f78d89ced", [:mix], [], "hexpm", "26549a1d6345e2172eb1c233866756ae44a9609bd33ee6f99147ab3fd87fd842"},
|
||||
"postgrex": {:hex, :postgrex, "0.17.2", "a3ec9e3239d9b33f1e5841565c4eb200055c52cc0757a22b63ca2d529bbe764c", [:mix], [{:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "80a918a9e9531d39f7bd70621422f3ebc93c01618c645f2d91306f50041ed90c"},
|
||||
"postgrex": {:hex, :postgrex, "0.17.3", "c92cda8de2033a7585dae8c61b1d420a1a1322421df84da9a82a6764580c503d", [:mix], [{:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "946cf46935a4fdca7a81448be76ba3503cff082df42c6ec1ff16a4bdfbfb098d"},
|
||||
"protobuf": {:hex, :protobuf, "0.12.0", "58c0dfea5f929b96b5aa54ec02b7130688f09d2de5ddc521d696eec2a015b223", [:mix], [{:jason, "~> 1.2", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "75fa6cbf262062073dd51be44dd0ab940500e18386a6c4e87d5819a58964dc45"},
|
||||
"ranch": {:hex, :ranch, "1.8.0", "8c7a100a139fd57f17327b6413e4167ac559fbc04ca7448e9be9057311597a1d", [:make, :rebar3], [], "hexpm", "49fbcfd3682fab1f5d109351b61257676da1a2fdbe295904176d5e521a2ddfe5"},
|
||||
"swoosh": {:hex, :swoosh, "1.11.4", "9b353f998cba3c5e101a0669559c2fb2757b5d9eb7db058bf08687d82e93e416", [:mix], [{:cowboy, "~> 1.1 or ~> 2.4", [hex: :cowboy, repo: "hexpm", optional: true]}, {:ex_aws, "~> 2.1", [hex: :ex_aws, repo: "hexpm", optional: true]}, {:finch, "~> 0.6", [hex: :finch, repo: "hexpm", optional: true]}, {:gen_smtp, "~> 0.13 or ~> 1.0", [hex: :gen_smtp, repo: "hexpm", optional: true]}, {:hackney, "~> 1.9", [hex: :hackney, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:mail, "~> 0.2", [hex: :mail, repo: "hexpm", optional: true]}, {:mime, "~> 1.1 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_cowboy, ">= 1.0.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "d3390914022a456ae1604bfcb3431bd12509b2afe8c70296bae6c9dca4903d0f"},
|
||||
"swoosh": {:hex, :swoosh, "1.11.5", "429dccde78e2f60c6339e96917efecebca9d1f254d2878a150f580d2f782260b", [:mix], [{:cowboy, "~> 1.1 or ~> 2.4", [hex: :cowboy, repo: "hexpm", optional: true]}, {:ex_aws, "~> 2.1", [hex: :ex_aws, repo: "hexpm", optional: true]}, {:finch, "~> 0.6", [hex: :finch, repo: "hexpm", optional: true]}, {:gen_smtp, "~> 0.13 or ~> 1.0", [hex: :gen_smtp, repo: "hexpm", optional: true]}, {:hackney, "~> 1.9", [hex: :hackney, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}, {:mail, "~> 0.2", [hex: :mail, repo: "hexpm", optional: true]}, {:mime, "~> 1.1 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_cowboy, ">= 1.0.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "21ee57dcd68d2f56d3bbe11e76d56d142b221bb12b6018c551cc68442b800040"},
|
||||
"tailwind": {:hex, :tailwind, "0.2.1", "83d8eadbe71a8e8f67861fe7f8d51658ecfb258387123afe4d9dc194eddc36b0", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}], "hexpm", "e8a13f6107c95f73e58ed1b4221744e1eb5a093cd1da244432067e19c8c9a277"},
|
||||
"tailwind_formatter": {:hex, :tailwind_formatter, "0.3.6", "f3b02687a79a99106f2cee604d36561091ab5b9c9d16a97ae5901d91b3357047", [:mix], [{:phoenix_live_view, ">= 0.17.6", [hex: :phoenix_live_view, repo: "hexpm", optional: true]}], "hexpm", "3a0d75dad1700f9fa9394185c4ce0eb0eff2b1a0eb9aef66b4b382eae657bded"},
|
||||
"tailwind_formatter": {:hex, :tailwind_formatter, "0.3.7", "2728d031e6803dfddf63f1dd7c64b5b9fd70ffdf635709c50f47589f4fb48861", [:mix], [{:phoenix_live_view, ">= 0.17.6", [hex: :phoenix_live_view, repo: "hexpm", optional: true]}], "hexpm", "3d91ac4d4622505b09c0f4678512281515b4fbe7644f012da1bd2722f5880185"},
|
||||
"telemetry": {:hex, :telemetry, "1.2.1", "68fdfe8d8f05a8428483a97d7aab2f268aaff24b49e0f599faa091f1d4e7f61c", [:rebar3], [], "hexpm", "dad9ce9d8effc621708f99eac538ef1cbe05d6a874dd741de2e689c47feafed5"},
|
||||
"telemetry_metrics": {:hex, :telemetry_metrics, "0.6.1", "315d9163a1d4660aedc3fee73f33f1d355dcc76c5c3ab3d59e76e3edf80eef1f", [:mix], [{:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "7be9e0871c41732c233be71e4be11b96e56177bf15dde64a8ac9ce72ac9834c6"},
|
||||
"telemetry_poller": {:hex, :telemetry_poller, "1.0.0", "db91bb424e07f2bb6e73926fcafbfcbcb295f0193e0a00e825e589a0a47e8453", [:rebar3], [{:telemetry, "~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "b3a24eafd66c3f42da30fc3ca7dda1e9d546c12250a2d60d7b81d264fbec4f6e"},
|
||||
"websock": {:hex, :websock, "0.5.2", "b3c08511d8d79ed2c2f589ff430bd1fe799bb389686dafce86d28801783d8351", [:mix], [], "hexpm", "925f5de22fca6813dfa980fb62fd542ec43a2d1a1f83d2caec907483fe66ff05"},
|
||||
"websock_adapter": {:hex, :websock_adapter, "0.5.3", "4908718e42e4a548fc20e00e70848620a92f11f7a6add8cf0886c4232267498d", [:mix], [{:bandit, ">= 0.6.0", [hex: :bandit, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.6", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:websock, "~> 0.5", [hex: :websock, repo: "hexpm", optional: false]}], "hexpm", "cbe5b814c1f86b6ea002b52dd99f345aeecf1a1a6964e209d208fb404d930d3d"},
|
||||
"websock": {:hex, :websock, "0.5.3", "2f69a6ebe810328555b6fe5c831a851f485e303a7c8ce6c5f675abeb20ebdadc", [:mix], [], "hexpm", "6105453d7fac22c712ad66fab1d45abdf049868f253cf719b625151460b8b453"},
|
||||
"websock_adapter": {:hex, :websock_adapter, "0.5.4", "7af8408e7ed9d56578539594d1ee7d8461e2dd5c3f57b0f2a5352d610ddde757", [:mix], [{:bandit, ">= 0.6.0", [hex: :bandit, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.6", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:websock, "~> 0.5", [hex: :websock, repo: "hexpm", optional: false]}], "hexpm", "d2c238c79c52cbe223fcdae22ca0bb5007a735b9e933870e241fce66afb4f4ab"},
|
||||
}
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
defmodule PrymnWeb.PageControllerTest do
|
||||
alias Prymn.Accounts
|
||||
use PrymnWeb.ConnCase
|
||||
|
||||
import Prymn.AccountsFixtures
|
||||
|
||||
test "redirect unauthenticated user", %{conn: conn} do
|
||||
conn = get(conn, ~p"/")
|
||||
assert html_response(conn, 302) =~ "redirected"
|
||||
|
|
|
@ -50,8 +50,10 @@ defmodule PrymnWeb.UserConfirmationLiveTest do
|
|||
"Email confirmation link is invalid or it has expired"
|
||||
|
||||
# when logged in
|
||||
conn = build_conn()
|
||||
|
||||
{:ok, lv, _html} =
|
||||
build_conn()
|
||||
conn
|
||||
|> log_in_user(user)
|
||||
|> live(~p"/auth/confirm/#{token}")
|
||||
|
||||
|
|
Loading…
Reference in a new issue