Prepare for 17.11

pull/5/head
Christophe Romain 7 years ago
parent 01d840bb6a
commit 5e420beeea

@ -1,7 +1,7 @@
FROM alpine:3.6
MAINTAINER ProcessOne <contact@process-one.net>
ENV REFRESHED_AT=2017-10-13 \
ENV REFRESHED_AT=2017-11-21 \
HOME=/home/p1 \
TERM=xterm \
LC_ALL=C.UTF-8 \
@ -11,19 +11,22 @@ ENV REFRESHED_AT=2017-10-13 \
# Create directory structure and user for ejabberd
RUN addgroup p1 -g 9000 && adduser -s /bin/bash -D -G p1 p1 -u 9000 && \
mkdir -p ${HOME}/ejabberd ${HOME}/cfg ${HOME}/log ${HOME}/db && \
mkdir -p ${HOME}/ejabberd ${HOME}/ejabberd/config ${HOME}/ejabberd/log ${HOME}/ejabberd/mnesiadb && \
chown -R p1:p1 ${HOME}
ENV P1DATA=${HOME}/db \
P1LOG=${HOME}/log
ENV P1DATA=${HOME}/ejabberd/mnesiadb \
P1LOG=${HOME}/ejabberd/log \
P1CFG=${HOME}/ejabberd/config
COPY ejabberd.yml ${HOME}/cfg/
COPY ejabberd.yml ${HOME}/ejabberd/config/
COPY server.pem ${HOME}/ejabberd/config/
# TODO Make it possible to define which version of Alpine we would like to use.
#RUN echo "http://nl.alpinelinux.org/alpine/v3.6/main" > /etc/apk/repositories && \
# echo "http://nl.alpinelinux.org/alpine/v3.6/community" >> /etc/apk/repositories && \
RUN apk upgrade --update musl && \
apk add bash su-exec libstdc++ ncurses-libs openssl expat yaml zlib sqlite && \
apk add curl ca-certificates && update-ca-certificates && \
rm -rf /var/cache/apk/*
EXPOSE 5222 5269 5280
@ -36,12 +39,12 @@ RUN tar -xzf ejabberd.tar.gz -C ${HOME}/ejabberd/ && \
rm ${HOME}/ejabberd.tar.gz
# Volumes that you may want make persistent (share and backup)
VOLUME ["/home/p1/log/", "/home/p1/db/"]
VOLUME ["/home/p1/ejabberd/log/","/home/p1/ejabberd/mnesiadb/","/home/p1/ejabberd/config/"]
WORKDIR /home/p1/ejabberd
WORKDIR ${HOME}/ejabberd
COPY docker-entrypoint.sh /
COPY ejabberd-api /home/p1/
COPY ejabberd-api ${HOME}
# CMD ./bin/ejabberd foreground
ENTRYPOINT ["/docker-entrypoint.sh"]

@ -1,6 +1,6 @@
#/bin/bash
VERSION=17.09
VERSION=17.11
GREEN='\033[0;32m'
NC='\033[0m' # No Color]]'
@ -15,7 +15,6 @@ if [ ! -d ejbuild ]; then
git clone https://github.com/processone/ejabberd.git ejbuild
fi
(cd ejbuild; git checkout master && git pull && git checkout $VERSION)
cp mix.exs ejbuild
cat > ejbuild/vars.config <<EOF
{mysql, true}.
{pgsql, true}.

@ -1,5 +1,5 @@
###
### ejabberd configuration file
###' ejabberd configuration file
###
###
@ -24,8 +24,8 @@
### > Art thou not Romeo,
### and a Montague?
### =======
### LOGGING
###. =======
###' LOGGING
##
## loglevel: Verbosity of log files generated by ejabberd.
@ -36,7 +36,7 @@
## 4: Info
## 5: Debug
##
loglevel: 3
loglevel: 4
##
## rotation: Describe how to rotate logs. Either size and/or date can trigger
@ -55,7 +55,7 @@ loglevel: 3
##
log_rotate_size: 10485760
log_rotate_date: ""
log_rotate_count: 3
log_rotate_count: 1
##
## overload protection: If you want to limit the number of messages per second
@ -72,9 +72,18 @@ log_rate_limit: 100
## watchdog_admins:
## - "bob@example.com"
###. ===============
###' NODE PARAMETERS
### ================
### SERVED HOSTNAMES
##
## net_ticktime: Specifies net_kernel tick time in seconds. This options must have
## identical value on all nodes, and in most cases shouldn't be changed at all from
## default value.
##
## net_ticktime: 60
###. ================
###' SERVED HOSTNAMES
##
## hosts: Domains served by ejabberd.
@ -94,8 +103,41 @@ hosts:
##
## route_subdomains: s2s
### ===============
### LISTENING PORTS
###. ============
###' Certificates
## List all available PEM files containing certificates for your domains,
## chains of certificates or certificate keys. Full chains will be built
## automatically by ejabberd.
##
certfiles:
- "/home/p1/ejabberd/config/server.pem"
## - "/etc/letsencrypt/live/example.org/*.pem"
## - "/etc/letsencrypt/live/example.com/*.pem"
##
## If your system provides only a single CA file (CentOS/FreeBSD):
## s2s_cafile: "/etc/ssl/certs/ca-bundle.pem"
###. =================
###' TLS configuration
define_macro:
'TLS_CIPHERS': "HIGH:!aNULL:!eNULL:!3DES:@STRENGTH"
'TLS_OPTIONS':
- "no_sslv3"
- "cipher_server_preference"
- "no_compression"
## 'DH_FILE': "/path/to/dhparams.pem" # generated with: openssl dhparam -out dhparams.pem 2048
##
## c2s_dhfile: 'DH_FILE'
## s2s_dhfile: 'DH_FILE'
c2s_ciphers: 'TLS_CIPHERS'
s2s_ciphers: 'TLS_CIPHERS'
c2s_protocol_options: 'TLS_OPTIONS'
s2s_protocol_options: 'TLS_OPTIONS'
###. ===============
###' LISTENING PORTS
##
## listen: The ports ejabberd will listen on, which service each is handled
@ -104,13 +146,8 @@ hosts:
listen:
-
port: 5222
ip: "::"
module: ejabberd_c2s
##
## If TLS is compiled in and you installed a SSL
## certificate, specify the full path to the
## file and uncomment these lines:
##
## certfile: "/path/to/ssl.pem"
## starttls: true
##
## To enforce TLS encryption for client connections,
@ -118,26 +155,50 @@ listen:
##
## starttls_required: true
##
## Custom OpenSSL options
## Stream compression
##
## zlib: true
##
## protocol_options:
## - "no_sslv3"
## - "no_tlsv1"
max_stanza_size: 65536
shaper: c2s_shaper
access: c2s
-
port: 5269
ip: "::"
module: ejabberd_s2s_in
max_stanza_size: 131072
shaper: s2s_shaper
-
port: 5280
ip: "::"
module: ejabberd_http
request_handlers:
"/ws": ejabberd_http_ws
"/oauth": ejabberd_oauth
"/api": mod_http_api
## "/pub/archive": mod_http_fileserver
web_admin: true
## register: true
captcha: false
##
## ejabberd_service: Interact with external components (transports, ...)
##
## -
## port: 8888
## ip: "::"
## module: ejabberd_service
## access: all
## shaper_rule: fast
## ip: "127.0.0.1"
## privilege_access:
## roster: "both"
## message: "outgoing"
## presence: "roster"
## delegations:
## "urn:xmpp:mam:1":
## filtering: ["node"]
## "http://jabber.org/protocol/pubsub":
## filtering: []
## hosts:
## "icq.example.org":
## password: "secret"
@ -157,48 +218,39 @@ listen:
##
## -
## port: 4560
## ip: "::"
## module: ejabberd_xmlrpc
-
port: 5280
module: ejabberd_http
## request_handlers:
## "/pub/archive": mod_http_fileserver
web_admin: true
http_poll: true
http_bind: true
## register: true
captcha: true
request_handlers:
"/oauth": ejabberd_oauth
"/api": mod_http_api
## maxsessions: 10
## timeout: 5000
## access_commands:
## admin:
## commands: all
## options: []
# We can use API from local machine to pass ejabberd commands
api_permissions:
"API used from localhost allows all calls":
- who:
- ip: "127.0.0.1/8"
- what:
- "*"
- "!stop"
- "!start"
##
## To enable secure http upload
##
## -
## port: 5444
## ip: "::"
## module: ejabberd_http
## request_handlers:
## "": mod_http_upload
## tls: true
##
## s2s_use_starttls: Enable STARTTLS + Dialback for S2S connections.
## Allowed values are: false optional required required_trusted
## You must specify a certificate file.
##
## s2s_use_starttls: optional
## Disabling digest-md5 SASL authentication. digest-md5 requires plain-text
## password storage (see auth_password_format option).
## disable_sasl_mechanisms: "digest-md5"
##
## s2s_certfile: Specify a certificate file.
##
## s2s_certfile: "/path/to/ssl.pem"
###. ==================
###' S2S GLOBAL OPTIONS
## Custom OpenSSL options
##
## s2s_protocol_options:
## - "no_sslv3"
## - "no_tlsv1"
## s2s_use_starttls: Enable STARTTLS for S2S connections.
## Allowed values are: false, optional or required
## You must specify 'certfiles' option
##
s2s_use_starttls: optional
##
## domain_certfile: Specify a different certificate for each served hostname.
@ -220,15 +272,15 @@ api_permissions:
## Outgoing S2S options
##
## Preferred address families (which to try first) and connect timeout
## in milliseconds.
## in seconds.
##
## outgoing_s2s_families:
## - ipv4
## - ipv6
## outgoing_s2s_timeout: 10000
## outgoing_s2s_timeout: 190
### ==============
### AUTHENTICATION
###. ==============
###' AUTHENTICATION
##
## auth_method: Method used to authenticate the users.
@ -254,10 +306,10 @@ auth_method: internal
## extauth_program: "/path/to/authentication/script"
##
## Authentication using ODBC
## Authentication using SQL
## Remember to setup a database in the next section.
##
## auth_method: odbc
## auth_method: sql
##
## Authentication using PAM
@ -318,8 +370,8 @@ auth_method: internal
## - internal
## - anonymous
### ==============
### DATABASE SETUP
###. ==============
###' DATABASE SETUP
## ejabberd by default uses the internal Mnesia database,
## so you do not necessarily need this section.
@ -330,51 +382,57 @@ auth_method: internal
##
## MySQL server:
##
## odbc_type: mysql
## odbc_server: "server"
## odbc_database: "database"
## odbc_username: "username"
## odbc_password: "password"
## sql_type: mysql
## sql_server: "server"
## sql_database: "database"
## sql_username: "username"
## sql_password: "password"
##
## If you want to specify the port:
## odbc_port: 1234
## sql_port: 1234
##
## PostgreSQL server:
##
## odbc_type: pgsql
## odbc_server: "server"
## odbc_database: "database"
## odbc_username: "username"
## odbc_password: "password"
## sql_type: pgsql
## sql_server: "server"
## sql_database: "database"
## sql_username: "username"
## sql_password: "password"
##
## If you want to specify the port:
## odbc_port: 1234
## sql_port: 1234
##
## If you use PostgreSQL, have a large database, and need a
## faster but inexact replacement for "select count(*) from users"
##
## pgsql_users_number_estimate: true
##
## SQLite:
##
## sql_type: sqlite
## sql_database: "/home/p1/ejabberd/database/ejabberd.db"
##
## ODBC compatible or MSSQL server:
##
## odbc_type: odbc
## odbc_server: "DSN=ejabberd;UID=ejabberd;PWD=ejabberd"
## sql_type: odbc
## sql_server: "DSN=ejabberd;UID=ejabberd;PWD=ejabberd"
##
## Number of connections to open to the database for each virtual host
##
## odbc_pool_size: 10
## sql_pool_size: 10
##
## Interval to make a dummy SQL request to keep the connections to the
## database alive. Specify in seconds: for example 28800 means 8 hours
##
## odbc_keepalive_interval: undefined
## sql_keepalive_interval: undefined
### ===============
### TRAFFIC SHAPERS
###. ===============
###' TRAFFIC SHAPERS
shaper:
##
@ -391,7 +449,7 @@ shaper:
## This option specifies the maximum number of elements in the queue
## of the FSM. Refer to the documentation for details.
##
max_fsm_queue: 1000
max_fsm_queue: 10000
###. ====================
###' ACCESS CONTROL LISTS
@ -400,16 +458,16 @@ acl:
## The 'admin' ACL grants administrative privileges to XMPP accounts.
## You can put here as many accounts as you want.
##
## admin:
## user:
## - "aleksey": "localhost"
## - "ermine": "example.org"
admin:
user:
- "admin@localhost"
##
## Blocked users
##
## blocked:
## user:
## - "baduser": "example.org"
## - "baduser@example.org"
## - "test"
## Local users: don't modify this.
@ -425,7 +483,7 @@ acl:
## - "jabber.org"
## aleksey:
## user:
## - "aleksey": "jabber.ru"
## - "aleksey@jabber.ru"
## test:
## user_regexp: "^test"
## user_glob: "test*"
@ -436,6 +494,8 @@ acl:
loopback:
ip:
- "127.0.0.0/8"
- "::1/128"
- "::FFFF:127.0.0.1/128"
##
## Bad XMPP servers
@ -453,66 +513,114 @@ acl:
## acl:
## admin:
## user:
## - "bob-local": "localhost"
## - "bob-local@localhost"
### ============
### ACCESS RULES
access:
###. ============
###' SHAPER RULES
shaper_rules:
## Maximum number of simultaneous sessions allowed for a single user:
max_user_sessions:
all: 10
max_user_sessions: 10
## Maximum number of offline messages that users can have:
max_user_offline_messages:
admin: 5000
all: 100
- 5000: admin
- 100
## For C2S connections, all users except admins use the "normal" shaper
c2s_shaper:
- none: admin
- normal
## All S2S connections use the "fast" shaper
s2s_shaper: fast
###. ============
###' ACCESS RULES
access_rules:
## This rule allows access only for local users:
local:
local: allow
- allow: local
## Only non-blocked users can use c2s connections:
c2s:
blocked: deny
all: allow
## For C2S connections, all users except admins use the "normal" shaper
c2s_shaper:
admin: none
all: normal
## All S2S connections use the "fast" shaper
s2s_shaper:
all: fast
- deny: blocked
- allow
## Only admins can send announcement messages:
announce:
admin: allow
- allow: admin
## Only admins can use the configuration interface:
configure:
admin: allow
## Admins of this server are also admins of the MUC service:
muc_admin:
admin: allow
- allow: admin
## Only accounts of the local ejabberd server can create rooms:
muc_create:
local: allow
## All users are allowed to use the MUC service:
muc:
all: allow
- allow: local
## Only accounts on the local ejabberd server can create Pubsub nodes:
pubsub_createnode:
local: allow
- allow: local
## In-band registration allows registration of any possible username.
## To disable in-band registration, replace 'allow' with 'deny'.
register:
all: allow
- allow
## Only allow to register from localhost
trusted_network:
loopback: allow
- allow: loopback
## Do not establish S2S connections with bad servers
## If you enable this you also have to uncomment "s2s_access: s2s"
## s2s:
## bad_servers: deny
## all: allow
## - deny:
## - ip: "XXX.XXX.XXX.XXX/32"
## - deny:
## - ip: "XXX.XXX.XXX.XXX/32"
## - allow
## ===============
## API PERMISSIONS
## ===============
##
## This section allows you to define who and using what method
## can execute commands offered by ejabberd.
##
## By default "console commands" section allow executing all commands
## issued using ejabberdctl command, and "admin access" section allows
## users in admin acl that connect from 127.0.0.1 to execute all
## commands except start and stop with any available access method
## (ejabberdctl, http-api, xmlrpc depending what is enabled on server).
##
## If you remove "console commands" there will be one added by
## default allowing executing all commands, but if you just change
## permissions in it, version from config file will be used instead
## of default one.
##
api_permissions:
"console commands":
from:
- ejabberd_ctl
who: all
what: "*"
"admin access":
who:
- access:
- allow:
- acl: loopback
- acl: admin
- oauth:
- scope: "ejabberd:admin"
- access:
- allow:
- acl: loopback
- acl: admin
what:
- "*"
- "!stop"
- "!start"
"public commands":
who:
- ip: "127.0.0.1/8"
what:
- "status"
- "connected_users_number"
## By default the frequency of account registrations from the same IP
## is limited to 1 account every 10 minutes. To disable, specify: infinity
## registration_timeout: 600
##
## Define specific Access Rules in a virtual host.
##
@ -520,13 +628,13 @@ access:
## "localhost":
## access:
## c2s:
## admin: allow
## all: deny
## - allow: admin
## - deny
## register:
## all: deny
## - deny
### ================
### DEFAULT LANGUAGE
###. ================
###' DEFAULT LANGUAGE
##
## language: Default language used for server messages.
@ -540,8 +648,8 @@ language: "en"
## "localhost":
## language: "ru"
### =======
### CAPTCHA
###. =======
###' CAPTCHA
##
## Full path to a script that generates the image.
@ -558,39 +666,82 @@ language: "en"
##
## captcha_limit: 5
### =======
### MODULES
###. ====
###' ACME
##
## In order to use the acme certificate acquiring through "Let's Encrypt"
## an http listener has to be configured to listen to port 80 so that
## the authorization challenges posed by "Let's Encrypt" can be solved.
##
## A simple way of doing this would be to add the following in the listening
## section and to configure port forwarding from 80 to 5280 either via NAT
## (for ipv4 only) or using frontends such as haproxy/nginx/sslh/etc.
## -
## port: 5280
## ip: "::"
## module: ejabberd_http
acme:
## A contact mail that the ACME Certificate Authority can contact in case of
## an authorization issue, such as a server-initiated certificate revocation.
## It is not mandatory to provide an email address but it is highly suggested.
contact: "mailto:example-admin@example.com"
## The ACME Certificate Authority URL.
## This could either be:
## - https://acme-v01.api.letsencrypt.org - (Default) for the production CA
## - https://acme-staging.api.letsencrypt.org - for the staging CA
## - http://localhost:4000 - for a local version of the CA
ca_url: "https://acme-v01.api.letsencrypt.org"
###. =======
###' MODULES
##
## Modules enabled in all ejabberd virtual hosts.
##
modules:
mod_adhoc: {}
## mod_admin_extra: {}
mod_admin_extra: {}
mod_announce: # recommends mod_adhoc
access: announce
mod_blocking: {} # requires mod_privacy
mod_caps: {}
mod_carboncopy: {}
mod_client_state:
drop_chat_states: true
queue_presence: false
mod_client_state: {}
mod_configure: {} # requires mod_adhoc
## mod_delegation: {} # for xep0356
mod_disco: {}
## mod_echo: {}
mod_irc: {}
## mod_irc: {}
mod_bosh: {}
## mod_http_fileserver:
## docroot: "/var/www"
## accesslog: "/var/log/ejabberd/access.log"
## mod_http_upload:
## # docroot: "@HOME@/upload"
## put_url: "https://@HOST@:5444"
## thumbnail: false # otherwise needs the identify command from ImageMagick installed
## mod_http_upload_quota:
## max_days: 30
mod_last: {}
## XEP-0313: Message Archive Management
## You might want to setup a SQL backend for MAM because the mnesia database is
## limited to 2GB which might be exceeded on large servers
## mod_mam: {} # for xep0313, mnesia is limited to 2GB, better use an SQL backend
mod_muc:
## host: "conference.@HOST@"
access: muc
access:
- allow
access_admin:
- allow: admin
access_create: muc_create
access_persistent: muc_create
access_admin: muc_admin
mod_muc_admin: {}
## mod_muc_log: {}
## mod_multicast: {}
mod_offline:
access_max_user_messages: max_user_offline_messages
mod_ping: {}
@ -609,19 +760,18 @@ modules:
last_item_cache: false
plugins:
- "flat"
- "hometree"
- "pep" # pep requires mod_caps
mod_push: {}
mod_push_keepalive: {}
mod_register:
##
## Protect In-Band account registrations with CAPTCHA.
##
## captcha_protected: true
## captcha_protected: true
##
## Set the minimum informational entropy for passwords.
##
## password_strength: 32
## password_strength: 32
##
## After successful registration, the user receives
## a message with this subject and body.
@ -631,31 +781,45 @@ modules:
body: |-
Hi.
Welcome to this XMPP server.
##
## When a user registers, send a notification to
## these XMPP accounts.
##
## registration_watchers:
## - "admin1@example.org"
## registration_watchers:
## - "admin1@example.org"
##
## Only clients in the server machine can register accounts
##
ip_access: trusted_network
##
## Local c2s or remote s2s users cannot register accounts
##
## access_from: deny
## access_from: deny
access: register
mod_roster: {}
mod_shared_roster: {}
mod_stats: {}
mod_time: {}
mod_vcard: {}
## mod_stats: {}
## mod_time: {}
mod_vcard:
search: false
mod_vcard_xupdate: {}
## Convert all avatars posted by Android clients from WebP to JPEG
## mod_avatar: # this module needs compile option
## convert:
## webp: jpeg
mod_version: {}
mod_stream_mgmt: {}
## Non-SASL Authentication (XEP-0078) is now disabled by default
## because it's obsoleted and is used mostly by abandoned
## client software
## mod_legacy_auth: {}
## The module for S2S dialback (XEP-0220). Please note that you cannot
## rely solely on dialback if you want to federate with other servers,
## because a lot of servers have dialback disabled and instead rely on
## PKIX authentication. Make sure you have proper certificates installed
## and check your accessibility at https://check.messaging.one/
mod_s2s_dialback: {}
mod_http_api: {}
##
## Enable modules with custom options in a specific virtual host
@ -674,7 +838,9 @@ modules:
allow_contrib_modules: true
###.
###'
### Local Variables:
### mode: yaml
### End:
### vim: set filetype=yaml tabstop=8
### vim: set filetype=yaml tabstop=8 foldmarker=###',###. foldmethod=marker:

@ -1,154 +0,0 @@
defmodule Ejabberd.Mixfile do
use Mix.Project
def project do
[app: :ejabberd,
version: "17.9.0",
description: description(),
elixir: "~> 1.4",
elixirc_paths: ["lib"],
compile_path: ".",
compilers: [:asn1] ++ Mix.compilers,
erlc_options: erlc_options(),
erlc_paths: ["asn1", "src"],
# Elixir tests are starting the part of ejabberd they need
aliases: [test: "test --no-start"],
package: package(),
deps: deps()]
end
def description do
"""
Robust, ubiquitous and massively scalable Jabber / XMPP Instant Messaging platform.
"""
end
def application do
[mod: {:ejabberd_app, []},
applications: [:ssl],
included_applications: [:lager, :mnesia, :inets, :p1_utils, :cache_tab,
:fast_tls, :stringprep, :fast_xml, :xmpp,
:stun, :fast_yaml, :esip, :jiffy, :p1_oauth2]
++ cond_apps()]
end
defp erlc_options do
# Use our own includes + includes from all dependencies
includes = ["include"] ++ deps_include(["fast_xml", "xmpp", "p1_utils"])
[:debug_info, {:d, :ELIXIR_ENABLED}] ++ Enum.map(includes, fn(path) -> {:i, path} end)
end
defp deps do
[{:lager, "~> 3.4.0"},
{:p1_utils, github: "processone/p1_utils", tag: "1.0.10", override: true, manager: :rebar},
{:cache_tab, github: "processone/cache_tab", tag: "1.0.11", override: true, manager: :rebar},
{:fast_tls, github: "processone/fast_tls", tag: "1.0.16", override: true, manager: :rebar},
{:fast_xml, github: "processone/fast_xml", tag: "1.1.24", override: true, manager: :rebar},
{:fast_yaml, github: "processone/fast_yaml", tag: "1.0.11", override: true, manager: :rebar},
{:stringprep, github: "processone/stringprep", tag: "1.0.10", override: true, manager: :rebar},
{:xmpp, github: "processone/xmpp", tag: "1.1.15", override: true, manager: :rebar},
{:stun, "~> 1.0"},
{:esip, "~> 1.0"},
{:jiffy, "~> 0.14.7"},
{:p1_oauth2, "~> 0.6.1"},
{:distillery, "~> 1.0"},
{:ex_doc, ">= 0.0.0", only: :dev}]
++ cond_deps()
end
defp deps_include(deps) do
base = case Mix.Project.deps_paths()[:ejabberd] do
nil -> "deps"
_ -> ".."
end
Enum.map(deps, fn dep -> base<>"/#{dep}/include" end)
end
defp cond_deps do
for {:true, dep} <- [{config(:mysql), {:p1_mysql, "~> 1.0"}},
{config(:pgsql), {:p1_pgsql, "~> 1.1"}},
{config(:sqlite), {:sqlite3, "~> 1.1"}},
{config(:riak), {:riakc, "~> 2.4"}},
{config(:redis), {:eredis, "~> 1.0"}},
{config(:zlib), {:ezlib, "~> 1.0"}},
{config(:iconv), {:iconv, "~> 1.0"}},
{config(:pam), {:epam, "~> 1.0"}},
{config(:tools), {:luerl, github: "rvirding/luerl", tag: "v0.2"}},
{config(:tools), {:meck, "~> 0.8.4"}},
{config(:tools), {:moka, github: "processone/moka", tag: "1.0.5c"}}], do:
dep
end
defp cond_apps do
for {:true, app} <- [{config(:redis), :eredis},
{config(:mysql), :p1_mysql},
{config(:pgsql), :p1_pgsql},
{config(:sqlite), :sqlite3},
{config(:zlib), :ezlib},
{config(:iconv), :iconv}], do:
app
end
defp package do
[# These are the default files included in the package
files: ["lib", "src", "priv", "mix.exs", "include", "README.md", "COPYING"],
maintainers: ["ProcessOne"],
licenses: ["GPLv2"],
links: %{"Site" => "https://www.ejabberd.im",
"Documentation" => "http://docs.ejabberd.im",
"Source" => "https://github.com/processone/ejabberd",
"ProcessOne" => "http://www.process-one.net/"}]
end
defp vars do
case :file.consult("vars.config") do
{:ok,config} -> config
_ -> [zlib: true, iconv: true]
end
end
defp config(key) do
case vars()[key] do
nil -> false
value -> value
end
end
end
defmodule Mix.Tasks.Compile.Asn1 do
use Mix.Task
alias Mix.Compilers.Erlang
@recursive true
@manifest ".compile.asn1"
def run(args) do
{opts, _, _} = OptionParser.parse(args, switches: [force: :boolean])
project = Mix.Project.config
source_paths = project[:asn1_paths] || ["asn1"]
dest_paths = project[:asn1_target] || ["src"]
mappings = Enum.zip(source_paths, dest_paths)
options = project[:asn1_options] || []
force = case opts[:force] do
:true -> [force: true]
_ -> [force: false]
end
Erlang.compile(manifest(), mappings, :asn1, :erl, force, fn
input, output ->
options = options ++ [:noobj, outdir: Erlang.to_erl_file(Path.dirname(output))]
case :asn1ct.compile(Erlang.to_erl_file(input), options) do
:ok -> {:ok, :done}
error -> error
end
end)
end
def manifests, do: [manifest()]
defp manifest, do: Path.join(Mix.Project.manifest_path, @manifest)
def clean, do: Erlang.clean(manifest())
end
Loading…
Cancel
Save