Add migrations, test keys, github workflows

This commit is contained in:
Simponic 2022-12-19 20:56:59 -07:00
parent 110eb0b199
commit 466295f26f
Signed by untrusted user who does not match committer: simponic
GPG Key ID: 52B3774857EB24B1
15 changed files with 122 additions and 23 deletions

27
.github/workflows/elixir.yml vendored Normal file
View File

@ -0,0 +1,27 @@
on: push
jobs:
test:
runs-on: ubuntu-latest
services:
db:
image: postgres:11
ports: ['5432:5432']
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2
- uses: actions/setup-elixir@v1
with:
otp-version: '25'
elixir-version: '1.14.0'
- run: mix deps.get
- run: mix deps.compile
- run: mix test

3
.gitignore vendored
View File

@ -24,6 +24,3 @@ server-*.tar
# Temporary files, for example, from tests. # Temporary files, for example, from tests.
/tmp/ /tmp/
# Private files, like configuration secrets or keys.
/priv/

View File

@ -1,21 +1,2 @@
# Server # CheSSH
**TODO: Add description**
## Installation
If [available in Hex](https://hex.pm/docs/publish), the package can be installed
by adding `server` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:server, "~> 0.1.0"}
]
end
```
Documentation can be generated with [ExDoc](https://github.com/elixir-lang/ex_doc)
and published on [HexDocs](https://hexdocs.pm). Once published, the docs can
be found at <https://hexdocs.pm/server>.

View File

@ -6,3 +6,6 @@ config :chessh, Chessh.Repo,
password: "postgres", password: "postgres",
hostname: "localhost", hostname: "localhost",
pool: Ecto.Adapters.SQL.Sandbox pool: Ecto.Adapters.SQL.Sandbox
config :esshd,
priv_dir: Path.join(Path.dirname(__DIR__), "priv/test_keys")

1
priv/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
keys/

View File

@ -0,0 +1,15 @@
defmodule Chessh.Repo.Migrations.CreatePlayer do
use Ecto.Migration
def change do
execute "CREATE EXTENSION IF NOT EXISTS citext", ""
create table(:players) do
add :username, :citext, null: false
add :hashed_password, :string, null: false
timestamps()
end
create unique_index(:players, [:username])
end
end

View File

@ -0,0 +1,14 @@
defmodule Chessh.Repo.Migrations.AddKeys do
use Ecto.Migration
def change do
create table(:keys) do
add :key, :string, null: false
add :name, :string, null: false
add :player_id, references(:players)
timestamps()
end
end
end

View File

View File

@ -0,0 +1 @@
127.0.0.1,127.0.0.1 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBC7Mpf2QIL32MmKxcrXAoZM3l7/hBy+8d+WqTRMun+tC/XYNiXSIDuZv01an3D1d22fmSpZiprFQzjB4yEz23qw= logan@yagami

View File

@ -0,0 +1,21 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABsgAAAAdzc2gtZH
NzAAAAgQCpKTDuhGwm9AXQPZuWSdHxraaiUV4cgu4uFlgHahV8Qzy9MGpDpp9lbt3uGe1F
MI0jQeIx0Bc3KxSiwLl0ggjF+f5100eZBRdw+3km/BQKaZYdPgSiZ9QdOAN2rRKl653uqA
85fnhm1UwS+q37RSvdJotBTh8mJk/PILGwRCoEhwAAABUA6hwmQu2jkb2KhfL/TjVTlwJF
Gk0AAACAMd1xLqW/iXVzWpNUxMUNeevDOwhY+RqgZUripwZhKuoNuFiLu79UkNpd/mKTkL
99PuxnM6RdaWjx54rTqw3DLsFjNR6mx5HOlDyIyIaGlXqIDiiGMNoFTCECJnYEupMtxwA1
a5jj742pDyKAspO9MwVrsHPNkAuAXOsnefFLtRkAAACBAIHWLyhaO8us6vzxlX5xH0bcbL
RNh8XcTXu5/xRB7kX1mBITZKBKm1RhBYPTrADlzC/P+gu4hF14KjvAU+pRCYOE2x2VT036
glcMQxa40id2g5v9tiIwoZF/UE0w8yargNd4kzVpWO2ecq8VYQ/j8o895Fy9Rr2qYbQlaf
iuT/hlAAAB6FkytPhZMrT4AAAAB3NzaC1kc3MAAACBAKkpMO6EbCb0BdA9m5ZJ0fGtpqJR
Xhy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xstE2HxdxNe7n/FEHuRfWYEhNkoEqbVGEFg9OsAOXML8/6C7iEXXgqO8BT6lEJg4TbHZVPTfqCVwxDFrjSJ3aDm/22IjChkX9QTTDzJquA13iTNWlY7Z5yrxVhD+Pyjz3kXL1GvaphtCVp+K5P+GU= logan@yagami

View File

@ -0,0 +1,9 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAaAAAABNlY2RzYS
1zaGEyLW5pc3RwMjU2AAAACG5pc3RwMjU2AAAAQQQuzKX9kCC99jJisXK1wKGTN5e/4Qcv
vHflqk0TLp/rQv12DYl0iA7mb9NWp9w9Xdtn5kqWYqaxUM4weMhM9t6sAAAAqFwD00xcA9
NMAAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBC7Mpf2QIL32MmKx
crXAoZM3l7/hBy+8d+WqTRMun+tC/XYNiXSIDuZv01an3D1d22fmSpZiprFQzjB4yEz23q
wAAAAgCA9MOKEi7uU/lhsow6WOv+uAfp3u3t0KE1qP7IWIYpAAAAAMbG9nYW5AeWFnYW1p
AQIDBA==
-----END OPENSSH PRIVATE KEY-----

View File

@ -0,0 +1 @@
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBC7Mpf2QIL32MmKxcrXAoZM3l7/hBy+8d+WqTRMun+tC/XYNiXSIDuZv01an3D1d22fmSpZiprFQzjB4yEz23qw= logan@yagami

View File

@ -0,0 +1,27 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABFwAAAAdzc2gtcn
NhAAAAAwEAAQAAAQEAijpwz+A646qB9EoDy8kXGJBRTlsSmTc8hzHoj2VhjeFOrrKrQxAl
tIJ8v0mDlOP+kBvhfUeg5bPUdAofQjAJMm1RJXlqPcLF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